Commit 19bf517b7f7f3a24c463bca932fdab4ba2684e55

Authored by aurel32
1 parent cd5158ea

target-alpha: gdb-stub support

(Vince Weaver)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5945 c046a42c-6fe2-441c-8c8c-71466251a162
gdbstub.c
@@ -990,6 +990,56 @@ static int cpu_gdb_write_register(CPUState *env, uint8_t *mem_buf, int n) @@ -990,6 +990,56 @@ static int cpu_gdb_write_register(CPUState *env, uint8_t *mem_buf, int n)
990 990
991 return 4; 991 return 4;
992 } 992 }
  993 +#elif defined (TARGET_ALPHA)
  994 +
  995 +#define NUM_CORE_REGS 65
  996 +
  997 +static int cpu_gdb_read_register(CPUState *env, uint8_t *mem_buf, int n)
  998 +{
  999 + if (n < 31) {
  1000 + GET_REGL(env->ir[n]);
  1001 + }
  1002 + else if (n == 31) {
  1003 + GET_REGL(0);
  1004 + }
  1005 + else if (n<63) {
  1006 + uint64_t val;
  1007 +
  1008 + val=*((uint64_t *)&env->fir[n-32]);
  1009 + GET_REGL(val);
  1010 + }
  1011 + else if (n==63) {
  1012 + GET_REGL(env->fpcr);
  1013 + }
  1014 + else if (n==64) {
  1015 + GET_REGL(env->pc);
  1016 + }
  1017 + else {
  1018 + GET_REGL(0);
  1019 + }
  1020 +
  1021 + return 0;
  1022 +}
  1023 +
  1024 +static int cpu_gdb_write_register(CPUState *env, uint8_t *mem_buf, int n)
  1025 +{
  1026 + target_ulong tmp;
  1027 + tmp = ldtul_p(mem_buf);
  1028 +
  1029 + if (n < 31) {
  1030 + env->ir[n] = tmp;
  1031 + }
  1032 +
  1033 + if (n > 31 && n < 63) {
  1034 + env->fir[n - 32] = ldfl_p(mem_buf);
  1035 + }
  1036 +
  1037 + if (n == 64 ) {
  1038 + env->pc=tmp;
  1039 + }
  1040 +
  1041 + return 8;
  1042 +}
993 #else 1043 #else
994 1044
995 #define NUM_CORE_REGS 0 1045 #define NUM_CORE_REGS 0
@@ -1277,6 +1327,8 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) @@ -1277,6 +1327,8 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
1277 s->c_cpu->active_tc.PC = addr; 1327 s->c_cpu->active_tc.PC = addr;
1278 #elif defined (TARGET_CRIS) 1328 #elif defined (TARGET_CRIS)
1279 s->c_cpu->pc = addr; 1329 s->c_cpu->pc = addr;
  1330 +#elif defined (TARGET_ALPHA)
  1331 + s->c_cpu->pc = addr;
1280 #endif 1332 #endif
1281 } 1333 }
1282 gdb_continue(s); 1334 gdb_continue(s);
@@ -1313,6 +1365,8 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) @@ -1313,6 +1365,8 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
1313 s->c_cpu->active_tc.PC = addr; 1365 s->c_cpu->active_tc.PC = addr;
1314 #elif defined (TARGET_CRIS) 1366 #elif defined (TARGET_CRIS)
1315 s->c_cpu->pc = addr; 1367 s->c_cpu->pc = addr;
  1368 +#elif defined (TARGET_ALPHA)
  1369 + s->c_cpu->pc = addr;
1316 #endif 1370 #endif
1317 } 1371 }
1318 cpu_single_step(s->c_cpu, sstep_flags); 1372 cpu_single_step(s->c_cpu, sstep_flags);
target-alpha/translate.c
@@ -2407,10 +2407,15 @@ static always_inline void gen_intermediate_code_internal (CPUState *env, @@ -2407,10 +2407,15 @@ static always_inline void gen_intermediate_code_internal (CPUState *env,
2407 * generation 2407 * generation
2408 */ 2408 */
2409 if (((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) || 2409 if (((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) ||
2410 - (env->singlestep_enabled) ||  
2411 num_insns >= max_insns) { 2410 num_insns >= max_insns) {
2412 break; 2411 break;
2413 } 2412 }
  2413 +
  2414 + if (env->singlestep_enabled) {
  2415 + gen_excp(&ctx, EXCP_DEBUG, 0);
  2416 + break;
  2417 + }
  2418 +
2414 #if defined (DO_SINGLE_STEP) 2419 #if defined (DO_SINGLE_STEP)
2415 break; 2420 break;
2416 #endif 2421 #endif