-
Notifications
You must be signed in to change notification settings - Fork 141
Enhance Trap class #602
Comments
How should I implement any of these conversions? Create macro list from MIPS traps enumeration (trap_types.h), separate it. Is it correct? |
First of all, I think it should be ISA-agnostic. For RISC-V converter, the macro should be the best option. |
Any progress? |
Just finished CS coursework. I plan to finish this issue this week. |
I wrote a RISC-V-like enumeration for MIPS traps. Can I do something similar for GDB-exceptions without copying signals.def? Or I have to write switch/case for from_gdb method without any defines. |
No, no, that's not what we need, at all, completely. We need a single Trap enumeration for all purposes, abstracted out of kernels, GDB, ISA etc. We generate exception while executing instruction: void executer_load_addr( Instr* instr)
{
// ..
if (!aligned(instr->mem_addr))
trap = Trap( UNALIGNED_ADDRESS);
} If we need to intergrate RISC-V simulator to the RISC-V toolchain, we'll convert trap result to RISC-V format: int execute_risc_v_simulation_step( Simulator* s)
{
auto trap = s->step(); // returns UNALIGNED_ADDRESS
retrun trap.to_riscv_format(); // returns 4
} Same for GDB. We have the following code now: mipt-mips/simulator/export/gdb/gdb_interface.cpp Lines 36 to 52 in 7912021
Instead, that function should use only Trap internal convertions: using GDBTrap = std::pair<enum sim_stop, int>;
static GDBTrap translate_trap( Trap mipt_trap, int exit_code)
{
if ( mipt_trap != HALT)
return GDBTrap( sim_stopped, mipt_trap.to_gdb_format());
} |
There are no enumeration for GDB-signals in mipt-mips. I've temporary created one. What is the best way to do this? Should I move internal conversion and dump methods to another file? There are no one-to-one correspondence between trap types (BREAKPOINT, EXPLICIT_TRAP and GDB_SIGNAL_TRAP). Can I resolve this in BREAKPOINT favor? |
Any working way is good.
That should be in trap.cc
In the most reasonable way. |
From/to riscv and gdb conversion methods. Dumping method.
#601 introduces a Trap enumeration.
We need to extend it to contain a class, similarly to MIPSRegister:
The text was updated successfully, but these errors were encountered: