stops jit block creation in case of ECALL and EBREAK

This commit is contained in:
Eyck-Alexander Jentzsch 2023-09-23 11:30:58 +02:00
parent 70839bbbf2
commit 417076f8e6
3 changed files with 117 additions and 119 deletions

View File

@ -172,8 +172,8 @@ private:
<%instr.behavior.eachLine{%>${it}
<%}%>
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,${idx});
gen_trap_check(tu);
return returnValue;
}
<%}%>
@ -305,9 +305,8 @@ template <typename ARCH> void vm_impl<ARCH>::gen_wait(tu_builder& tu, unsigned t
}
template <typename ARCH> void vm_impl<ARCH>::gen_trap_behavior(tu_builder& tu) {
tu("trap_entry_plugin:");
this->gen_sync(tu, POST_SYNC, -1);
tu("trap_entry:");
this->gen_sync(tu, POST_SYNC, -1);
tu("enter_trap(core_ptr, *trap_state, *pc, 0);");
tu.store(traits::LAST_BRANCH, tu.constant(std::numeric_limits<uint32_t>::max(),32));
tu("return *next_pc;");

View File

@ -2218,8 +2218,8 @@ private:
pc=pc+ 4;
this->gen_set_pc(pc, traits::NEXT_PC);
this->gen_raise_trap(0, 11);
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
auto returnValue = std::make_tuple(CONT,bb);
bb = this->leave_blk;
auto returnValue = std::make_tuple(TRAP,nullptr);
this->gen_trap_check(bb);
this->gen_sync(POST_SYNC, 38);
@ -2240,8 +2240,8 @@ private:
pc=pc+ 4;
this->gen_set_pc(pc, traits::NEXT_PC);
this->gen_raise_trap(0, 3);
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
auto returnValue = std::make_tuple(CONT,bb);
bb = this->leave_blk;
auto returnValue = std::make_tuple(TRAP,nullptr);
this->gen_trap_check(bb);
this->gen_sync(POST_SYNC, 39);
@ -2262,8 +2262,8 @@ private:
pc=pc+ 4;
this->gen_set_pc(pc, traits::NEXT_PC);
this->gen_leave_trap(3);
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
auto returnValue = std::make_tuple(CONT,bb);
bb = this->leave_blk;
auto returnValue = std::make_tuple(TRAP,nullptr);
this->gen_trap_check(bb);
this->gen_sync(POST_SYNC, 40);
@ -4282,8 +4282,8 @@ private:
pc=pc+ 2;
this->gen_set_pc(pc, traits::NEXT_PC);
this->gen_raise_trap(0, 3);
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
auto returnValue = std::make_tuple(CONT,bb);
bb = this->leave_blk;
auto returnValue = std::make_tuple(TRAP,nullptr);
this->gen_trap_check(bb);
this->gen_sync(POST_SYNC, 84);
@ -4351,8 +4351,8 @@ private:
pc=pc+ 2;
this->gen_set_pc(pc, traits::NEXT_PC);
this->gen_raise_trap(0, 2);
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
auto returnValue = std::make_tuple(CONT,bb);
bb = this->leave_blk;
auto returnValue = std::make_tuple(TRAP,nullptr);
this->gen_trap_check(bb);
this->gen_sync(POST_SYNC, 86);

View File

@ -357,8 +357,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,0);
gen_trap_check(tu);
return returnValue;
}
@ -392,8 +392,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,1);
gen_trap_check(tu);
return returnValue;
}
@ -434,8 +434,8 @@ private:
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,2);
gen_trap_check(tu);
return returnValue;
}
@ -462,11 +462,12 @@ private:
this->gen_raise_trap(tu, 0, 2);
}
else{
auto addr_mask = tu.assignment(tu.constant((uint32_t)- 2,32),32);
auto new_pc = tu.assignment(tu.ext((tu.bitwise_and(
(tu.add(
tu.load(rs1+ traits::X0, 0),
tu.constant((int16_t)sext<12>(imm),16))),
tu.constant(~ 0x1,8))),32,false),32);
addr_mask)),32,false),32);
tu.open_if(tu.urem(
new_pc,
tu.constant(static_cast<uint32_t>(traits:: INSTR_ALIGNMENT),32)));
@ -476,9 +477,7 @@ private:
tu.store(rd + traits::X0,
tu.constant((uint32_t)(PC+ 4),32));
}
auto PC_val_v = tu.assignment("PC_val", tu.bitwise_and(
new_pc,
tu.constant(~ 0x1,8)),32);
auto PC_val_v = tu.assignment("PC_val", new_pc,32);
tu.store(traits::NEXT_PC, PC_val_v);
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
tu.close_scope();
@ -486,8 +485,8 @@ private:
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,3);
gen_trap_check(tu);
return returnValue;
}
@ -529,8 +528,8 @@ private:
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,4);
gen_trap_check(tu);
return returnValue;
}
@ -572,8 +571,8 @@ private:
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,5);
gen_trap_check(tu);
return returnValue;
}
@ -615,8 +614,8 @@ private:
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,6);
gen_trap_check(tu);
return returnValue;
}
@ -658,8 +657,8 @@ private:
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,7);
gen_trap_check(tu);
return returnValue;
}
@ -701,8 +700,8 @@ private:
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,8);
gen_trap_check(tu);
return returnValue;
}
@ -744,8 +743,8 @@ private:
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,9);
gen_trap_check(tu);
return returnValue;
}
@ -784,8 +783,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,10);
gen_trap_check(tu);
return returnValue;
}
@ -824,8 +823,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,11);
gen_trap_check(tu);
return returnValue;
}
@ -864,8 +863,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,12);
gen_trap_check(tu);
return returnValue;
}
@ -904,8 +903,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,13);
gen_trap_check(tu);
return returnValue;
}
@ -944,8 +943,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,14);
gen_trap_check(tu);
return returnValue;
}
@ -980,8 +979,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,15);
gen_trap_check(tu);
return returnValue;
}
@ -1016,8 +1015,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,16);
gen_trap_check(tu);
return returnValue;
}
@ -1052,8 +1051,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,17);
gen_trap_check(tu);
return returnValue;
}
@ -1090,8 +1089,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,18);
gen_trap_check(tu);
return returnValue;
}
@ -1128,8 +1127,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,19);
gen_trap_check(tu);
return returnValue;
}
@ -1166,8 +1165,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,20);
gen_trap_check(tu);
return returnValue;
}
@ -1204,8 +1203,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,21);
gen_trap_check(tu);
return returnValue;
}
@ -1242,8 +1241,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,22);
gen_trap_check(tu);
return returnValue;
}
@ -1280,8 +1279,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,23);
gen_trap_check(tu);
return returnValue;
}
@ -1318,8 +1317,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,24);
gen_trap_check(tu);
return returnValue;
}
@ -1356,8 +1355,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,25);
gen_trap_check(tu);
return returnValue;
}
@ -1394,8 +1393,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,26);
gen_trap_check(tu);
return returnValue;
}
@ -1432,8 +1431,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,27);
gen_trap_check(tu);
return returnValue;
}
@ -1470,8 +1469,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,28);
gen_trap_check(tu);
return returnValue;
}
@ -1510,8 +1509,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,29);
gen_trap_check(tu);
return returnValue;
}
@ -1548,8 +1547,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,30);
gen_trap_check(tu);
return returnValue;
}
@ -1586,8 +1585,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,31);
gen_trap_check(tu);
return returnValue;
}
@ -1624,8 +1623,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,32);
gen_trap_check(tu);
return returnValue;
}
@ -1664,8 +1663,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,33);
gen_trap_check(tu);
return returnValue;
}
@ -1704,8 +1703,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,34);
gen_trap_check(tu);
return returnValue;
}
@ -1742,8 +1741,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,35);
gen_trap_check(tu);
return returnValue;
}
@ -1780,8 +1779,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,36);
gen_trap_check(tu);
return returnValue;
}
@ -1810,8 +1809,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,37);
gen_trap_check(tu);
return returnValue;
}
@ -1829,11 +1828,11 @@ private:
gen_set_pc(tu, pc, traits::NEXT_PC);
tu.open_scope();
this->gen_raise_trap(tu, 0, 11);
auto returnValue = std::make_tuple(CONT);
auto returnValue = std::make_tuple(TRAP);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,38);
gen_trap_check(tu);
return returnValue;
}
@ -1851,11 +1850,11 @@ private:
gen_set_pc(tu, pc, traits::NEXT_PC);
tu.open_scope();
this->gen_raise_trap(tu, 0, 3);
auto returnValue = std::make_tuple(CONT);
auto returnValue = std::make_tuple(TRAP);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,39);
gen_trap_check(tu);
return returnValue;
}
@ -1873,11 +1872,11 @@ private:
gen_set_pc(tu, pc, traits::NEXT_PC);
tu.open_scope();
this->gen_leave_trap(tu, 3);
auto returnValue = std::make_tuple(CONT);
auto returnValue = std::make_tuple(TRAP);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,40);
gen_trap_check(tu);
return returnValue;
}
@ -1898,8 +1897,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,41);
gen_trap_check(tu);
return returnValue;
}
@ -1939,8 +1938,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,42);
gen_trap_check(tu);
return returnValue;
}
@ -1982,8 +1981,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,43);
gen_trap_check(tu);
return returnValue;
}
@ -2025,8 +2024,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,44);
gen_trap_check(tu);
return returnValue;
}
@ -2063,8 +2062,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,45);
gen_trap_check(tu);
return returnValue;
}
@ -2105,8 +2104,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,46);
gen_trap_check(tu);
return returnValue;
}
@ -2147,8 +2146,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,47);
gen_trap_check(tu);
return returnValue;
}
@ -2175,8 +2174,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,48);
gen_trap_check(tu);
return returnValue;
}
@ -2214,8 +2213,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,49);
gen_trap_check(tu);
return returnValue;
}
@ -2255,8 +2254,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,50);
gen_trap_check(tu);
return returnValue;
}
@ -2296,8 +2295,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,51);
gen_trap_check(tu);
return returnValue;
}
@ -2337,8 +2336,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,52);
gen_trap_check(tu);
return returnValue;
}
@ -2395,8 +2394,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,53);
gen_trap_check(tu);
return returnValue;
}
@ -2442,8 +2441,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,54);
gen_trap_check(tu);
return returnValue;
}
@ -2473,7 +2472,7 @@ private:
tu.open_if(tu.icmp(ICmpInst::ICMP_NE,
tu.load(rs2+ traits::X0, 0),
tu.constant( 0,8)));
auto MMIN = tu.assignment(tu.constant( 1<<(static_cast<uint32_t>(traits:: XLEN)-1),8),32);
auto MMIN = tu.assignment(tu.constant((uint32_t)1<<(static_cast<uint32_t>(traits:: XLEN)-1),32),32);
tu.open_if(tu.logical_and(
tu.icmp(ICmpInst::ICMP_EQ,
tu.load(rs1+ traits::X0, 0),
@ -2503,8 +2502,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,55);
gen_trap_check(tu);
return returnValue;
}
@ -2550,8 +2549,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,56);
gen_trap_check(tu);
return returnValue;
}
@ -2585,8 +2584,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,57);
gen_trap_check(tu);
return returnValue;
}
@ -2617,8 +2616,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,58);
gen_trap_check(tu);
return returnValue;
}
@ -2648,8 +2647,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,59);
gen_trap_check(tu);
return returnValue;
}
@ -2685,8 +2684,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,60);
gen_trap_check(tu);
return returnValue;
}
@ -2707,8 +2706,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,61);
gen_trap_check(tu);
return returnValue;
}
@ -2737,8 +2736,8 @@ private:
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,62);
gen_trap_check(tu);
return returnValue;
}
@ -2772,8 +2771,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,63);
gen_trap_check(tu);
return returnValue;
}
@ -2805,8 +2804,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,64);
gen_trap_check(tu);
return returnValue;
}
@ -2839,8 +2838,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,65);
gen_trap_check(tu);
return returnValue;
}
@ -2862,8 +2861,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,66);
gen_trap_check(tu);
return returnValue;
}
@ -2892,8 +2891,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,67);
gen_trap_check(tu);
return returnValue;
}
@ -2930,8 +2929,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,68);
gen_trap_check(tu);
return returnValue;
}
@ -2960,8 +2959,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,69);
gen_trap_check(tu);
return returnValue;
}
@ -2990,8 +2989,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,70);
gen_trap_check(tu);
return returnValue;
}
@ -3020,8 +3019,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,71);
gen_trap_check(tu);
return returnValue;
}
@ -3050,8 +3049,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,72);
gen_trap_check(tu);
return returnValue;
}
@ -3080,8 +3079,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,73);
gen_trap_check(tu);
return returnValue;
}
@ -3108,8 +3107,8 @@ private:
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,74);
gen_trap_check(tu);
return returnValue;
}
@ -3141,8 +3140,8 @@ private:
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,75);
gen_trap_check(tu);
return returnValue;
}
@ -3174,8 +3173,8 @@ private:
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,76);
gen_trap_check(tu);
return returnValue;
}
@ -3211,8 +3210,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,77);
gen_trap_check(tu);
return returnValue;
}
@ -3247,8 +3246,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,78);
gen_trap_check(tu);
return returnValue;
}
@ -3282,8 +3281,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,79);
gen_trap_check(tu);
return returnValue;
}
@ -3304,12 +3303,12 @@ private:
pc=pc+ 2;
gen_set_pc(tu, pc, traits::NEXT_PC);
tu.open_scope();
if(rs1&&rs1<static_cast<uint32_t>(traits:: RFS)) {
auto PC_val_v = tu.assignment("PC_val", tu.bitwise_and(
tu.load(rs1%static_cast<uint32_t>(traits:: RFS)+ traits::X0, 0),
tu.constant(~ 0x1,8)),32);
tu.store(traits::NEXT_PC, PC_val_v);
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
if(rs1&&rs1<static_cast<uint32_t>(traits:: RFS)){ auto addr_mask = tu.assignment(tu.constant((uint32_t)- 2,32),32);
auto PC_val_v = tu.assignment("PC_val", tu.bitwise_and(
tu.load(rs1%static_cast<uint32_t>(traits:: RFS)+ traits::X0, 0),
addr_mask),32);
tu.store(traits::NEXT_PC, PC_val_v);
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
}
else{
this->gen_raise_trap(tu, 0, 2);
@ -3317,8 +3316,8 @@ private:
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,80);
gen_trap_check(tu);
return returnValue;
}
@ -3339,8 +3338,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,81);
gen_trap_check(tu);
return returnValue;
}
@ -3376,8 +3375,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,82);
gen_trap_check(tu);
return returnValue;
}
@ -3402,20 +3401,21 @@ private:
this->gen_raise_trap(tu, 0, 2);
}
else{
auto addr_mask = tu.assignment(tu.constant((uint32_t)- 2,32),32);
auto new_pc = tu.assignment(tu.load(rs1+ traits::X0, 0),32);
tu.store(1 + traits::X0,
tu.constant((uint32_t)(PC+ 2),32));
auto PC_val_v = tu.assignment("PC_val", tu.bitwise_and(
new_pc,
tu.constant(~ 0x1,8)),32);
addr_mask),32);
tu.store(traits::NEXT_PC, PC_val_v);
tu.store(traits::LAST_BRANCH, tu.constant(2U, 2));
}
auto returnValue = std::make_tuple(BRANCH);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,83);
gen_trap_check(tu);
return returnValue;
}
@ -3433,11 +3433,11 @@ private:
gen_set_pc(tu, pc, traits::NEXT_PC);
tu.open_scope();
this->gen_raise_trap(tu, 0, 3);
auto returnValue = std::make_tuple(CONT);
auto returnValue = std::make_tuple(TRAP);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,84);
gen_trap_check(tu);
return returnValue;
}
@ -3471,8 +3471,8 @@ private:
auto returnValue = std::make_tuple(CONT);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,85);
gen_trap_check(tu);
return returnValue;
}
@ -3490,11 +3490,11 @@ private:
gen_set_pc(tu, pc, traits::NEXT_PC);
tu.open_scope();
this->gen_raise_trap(tu, 0, 2);
auto returnValue = std::make_tuple(CONT);
auto returnValue = std::make_tuple(TRAP);
tu.close_scope();
gen_trap_check(tu);
vm_base<ARCH>::gen_sync(tu, POST_SYNC,86);
gen_trap_check(tu);
return returnValue;
}
@ -3626,9 +3626,8 @@ template <typename ARCH> void vm_impl<ARCH>::gen_wait(tu_builder& tu, unsigned t
}
template <typename ARCH> void vm_impl<ARCH>::gen_trap_behavior(tu_builder& tu) {
tu("trap_entry_plugin:");
this->gen_sync(tu, POST_SYNC, -1);
tu("trap_entry:");
this->gen_sync(tu, POST_SYNC, -1);
tu("enter_trap(core_ptr, *trap_state, *pc, 0);");
tu.store(traits::LAST_BRANCH, tu.constant(std::numeric_limits<uint32_t>::max(),32));
tu("return *next_pc;");