Browse Source

refine arch_if API and vm_base behavior

master
Eyck Jentzsch 3 months ago
parent
commit
3841cdb5d9
4 changed files with 5 additions and 15 deletions
  1. +1
    -1
      incl/iss/arch_if.h
  2. +1
    -11
      incl/iss/interp/vm_base.h
  3. +1
    -1
      src/tcc_jit_helper.cpp
  4. +2
    -2
      src/vm_base.cpp

+ 1
- 1
incl/iss/arch_if.h View File

@ -179,7 +179,7 @@ public:
* @param addr address where the trap enountered
* @return new (virtual) address to continue from
*/
virtual uint64_t enter_trap(uint64_t flags, uint64_t addr) { return 0; }
virtual uint64_t enter_trap(uint64_t flags, uint64_t addr, uint64_t instr) { return 0; }
/**
* vm decoded the instruction to return from trap (exception, interrupt),
* process accordingly in core

+ 1
- 11
incl/iss/interp/vm_base.h View File

@ -167,19 +167,9 @@ protected:
inline void do_sync(sync_type s, unsigned inst_id) {
if (s == PRE_SYNC) {
// update icount
get_reg<uint64_t>(arch::traits<ARCH>::ICOUNT)++;
ex_info.branch_taken=false;
// set PC
auto& next_pc = get_reg<addr_t>(arch::traits<ARCH>::NEXT_PC);
auto& pc = get_reg<addr_t>(arch::traits<ARCH>::PC);
pc=next_pc;
// copy over trap state
auto& pending_trap = get_reg<uint32_t>(arch::traits<ARCH>::PENDING_TRAP);
auto& trap_state = get_reg<uint32_t>(arch::traits<ARCH>::TRAP_STATE);
trap_state=pending_trap;
if (debugging_enabled())
tgt_adapter->check_continue(pc); //pre_instr_sync();
tgt_adapter->check_continue(get_reg<addr_t>(arch::traits<ARCH>::PC)); //pre_instr_sync();
}
if ((s & sync_exec))
core.notify_phase(notifier_mapping[s]);

+ 1
- 1
src/tcc_jit_helper.cpp View File

@ -92,7 +92,7 @@ std::ostream& write_prologue(std::ostream& os){
os<<"extern int write_mem4(void*, uint32_t, uint32_t, uint64_t, uint32_t);\n";
os<<"extern int read_mem8(void*, uint32_t, uint32_t, uint64_t, uint64_t*);\n";
os<<"extern int write_mem8(void*, uint32_t, uint32_t, uint64_t, uint64_t);\n";
os<<"extern uint64_t enter_trap(void*, uint64_t, uint64_t);\n";
os<<"extern uint64_t enter_trap(void*, uint64_t, uint64_t, uint64_t);\n";
os<<"extern uint64_t leave_trap(void*, uint64_t);\n";
os<<"extern void wait(void*, uint64_t);\n";
os<<"extern void print_string(void*, char*);\n";

+ 2
- 2
src/vm_base.cpp View File

@ -72,8 +72,8 @@ uint8_t write_mem_dbg(arch_if_ptr_t iface, uint32_t addr_type, uint32_t space, u
return iface->write((address_type)addr_type, access_type::DEBUG_WRITE, (uint16_t)space, addr, length, data);
}
uint64_t enter_trap(arch_if_ptr_t iface, uint64_t flags, uint64_t addr) {
return iface->enter_trap(flags, addr);
uint64_t enter_trap(arch_if_ptr_t iface, uint64_t flags, uint64_t addr, uint64_t instr) {
return iface->enter_trap(flags, addr, instr);
}
uint64_t leave_trap(arch_if_ptr_t iface, uint64_t flags) { return iface->leave_trap(flags); }

Loading…
Cancel
Save