From b45b3589facbe46d3dfe144d13a5baa6139de1e6 Mon Sep 17 00:00:00 2001 From: Eyck-Alexander Jentzsch Date: Fri, 27 Sep 2024 20:03:51 +0200 Subject: [PATCH] updates templates to immediately trap when gen_trap is called --- gen_input/templates/asmjit/CORENAME.cpp.gtl | 1 + gen_input/templates/llvm/CORENAME.cpp.gtl | 1 + 2 files changed, 2 insertions(+) diff --git a/gen_input/templates/asmjit/CORENAME.cpp.gtl b/gen_input/templates/asmjit/CORENAME.cpp.gtl index 7efab21..3dfb180 100644 --- a/gen_input/templates/asmjit/CORENAME.cpp.gtl +++ b/gen_input/templates/asmjit/CORENAME.cpp.gtl @@ -308,6 +308,7 @@ inline void vm_impl::gen_raise(jit_holder& jh, uint16_t trap_id, uint16_t auto tmp1 = get_reg_for(cc, traits::TRAP_STATE); mov(cc, tmp1, 0x80ULL << 24 | (cause << 16) | trap_id); mov(cc, get_ptr_for(jh, traits::TRAP_STATE), tmp1); + cc.jmp(jh.trap_entry); } template template diff --git a/gen_input/templates/llvm/CORENAME.cpp.gtl b/gen_input/templates/llvm/CORENAME.cpp.gtl index bcdf909..bf5828d 100644 --- a/gen_input/templates/llvm/CORENAME.cpp.gtl +++ b/gen_input/templates/llvm/CORENAME.cpp.gtl @@ -279,6 +279,7 @@ template void vm_impl::gen_raise_trap(uint16_t trap_id, uint16_t cause) { auto *TRAP_val = this->gen_const(32, 0x80 << 24 | (cause << 16) | trap_id); this->builder.CreateStore(TRAP_val, get_reg_ptr(traits::TRAP_STATE), true); + this->builder.CreateBr(this->trap_blk); } template