Compare commits
No commits in common. "6b9e5c766be9379a612443b37f6a5daaaf808000" and "43629abbd4022506ef5dad119f6e9e96e40cc1f6" have entirely different histories.
6b9e5c766b
...
43629abbd4
@ -39,7 +39,7 @@ static void cpu_print_instruction(instruction_t* instruction);
|
|||||||
|
|
||||||
void cpu_init()
|
void cpu_init()
|
||||||
{
|
{
|
||||||
cpu0 = calloc(1, sizeof(rv32_cpu_t));
|
cpu0 = malloc(sizeof(rv32_cpu_t));
|
||||||
cpu0->regs.zero = 0;
|
cpu0->regs.zero = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,6 @@ void gdbstub_thread_gdb()
|
|||||||
}
|
}
|
||||||
else if(packet[0] == 'g')
|
else if(packet[0] == 'g')
|
||||||
{
|
{
|
||||||
// g : read all registers -> send back all registers
|
|
||||||
char resp[32 * 8 + 8 + 1] = {0};
|
char resp[32 * 8 + 8 + 1] = {0};
|
||||||
|
|
||||||
// All general purpose registers in host byte order as chars
|
// All general purpose registers in host byte order as chars
|
||||||
@ -176,28 +175,6 @@ void gdbstub_thread_gdb()
|
|||||||
size_t size = 32 * 8 + 8;
|
size_t size = 32 * 8 + 8;
|
||||||
gdbstub_send_packet(resp, size);
|
gdbstub_send_packet(resp, size);
|
||||||
}
|
}
|
||||||
else if(packet[0] == 'G')
|
|
||||||
{
|
|
||||||
// G : write all registers -> read and set all registers
|
|
||||||
|
|
||||||
// All general purpose registers in host byte order as chars
|
|
||||||
for(size_t i = 1; i < 32; i++)
|
|
||||||
{
|
|
||||||
uint32_t value = 0;
|
|
||||||
sscanf(packet + 1 + i * 8, "%08x", &value);
|
|
||||||
value = ntohl(value);
|
|
||||||
|
|
||||||
cpu0->regs.x[i] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// PC register
|
|
||||||
uint32_t pc = 0;
|
|
||||||
sscanf(packet + 1 + 32 * 8, "%08x", &pc);
|
|
||||||
pc = ntohl(pc);
|
|
||||||
cpu0->pc = pc;
|
|
||||||
|
|
||||||
gdbstub_send_packet("OK", 2);
|
|
||||||
}
|
|
||||||
else gdbstub_send_unsupported();
|
else gdbstub_send_unsupported();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user