}
LENDFUNC(WRITE,READ,1,compemu_raw_cmp_pc,(IMPTR s))
-LOWFUNC(NONE,WRITE,1,compemu_raw_set_pc_i,(IMPTR s))
+STATIC_INLINE void compemu_raw_store_pc_state_from_work1(void)
{
- LOAD_U32(REG_WORK2, s);
- uintptr idx = (uintptr) &(regs.pc_p) - (uintptr) ®s;
+ uintptr idx = (uintptr)®s.pc_p - (uintptr)®s;
+ STR_rRI(REG_WORK1, R_REGSTRUCT, idx);
+ idx = (uintptr)®s.pc_oldp - (uintptr)®s;
+ STR_rRI(REG_WORK1, R_REGSTRUCT, idx);
+
+#ifdef NATMEM_OFFSET
+ SUB_rrr(REG_WORK2, REG_WORK1, R_MEMSTART);
+ idx = (uintptr)®s.pc - (uintptr)®s;
+ STR_rRI(REG_WORK2, R_REGSTRUCT, idx);
+ idx = (uintptr)®s.instruction_pc - (uintptr)®s;
STR_rRI(REG_WORK2, R_REGSTRUCT, idx);
+#endif
+}
+
+LOWFUNC(NONE,WRITE,1,compemu_raw_set_pc_i,(IMPTR s))
+{
+ LOAD_U32(REG_WORK1, s);
+ compemu_raw_store_pc_state_from_work1();
}
LENDFUNC(NONE,WRITE,1,compemu_raw_set_pc_i,(IMPTR s))
}
LENDFUNC(WRITE,READ,1,compemu_raw_cmp_pc,(IMPTR s))
+STATIC_INLINE void compemu_raw_store_pc_state_from_work1(void)
+{
+ uintptr idx = (uintptr)®s.pc_p - (uintptr)®s;
+ STR_xXi(REG_WORK1, R_REGSTRUCT, idx);
+ idx = (uintptr)®s.pc_oldp - (uintptr)®s;
+ STR_xXi(REG_WORK1, R_REGSTRUCT, idx);
+
+#ifdef NATMEM_OFFSET
+ SUB_xxx(REG_WORK2, REG_WORK1, R_MEMSTART);
+ idx = (uintptr)®s.pc - (uintptr)®s;
+ STR_wXi(REG_WORK2, R_REGSTRUCT, idx);
+ idx = (uintptr)®s.instruction_pc - (uintptr)®s;
+ STR_wXi(REG_WORK2, R_REGSTRUCT, idx);
+#endif
+}
+
LOWFUNC(NONE,WRITE,1,compemu_raw_set_pc_i,(IMPTR s))
{
LOAD_U64(REG_WORK1, s);
- uintptr idx = (uintptr) &(regs.pc_p) - (uintptr) ®s;
- STR_xXi(REG_WORK1, R_REGSTRUCT, idx);
+ compemu_raw_store_pc_state_from_work1();
}
LENDFUNC(NONE,WRITE,1,compemu_raw_set_pc_i,(IMPTR s))
/* now the exit points */
popall_execute_normal_setpc = get_target();
- uintptr idx = (uintptr) & (regs.pc_p) - (uintptr)®s;
-#if defined(CPU_AARCH64)
- STR_xXi(REG_WORK1, R_REGSTRUCT, idx);
-#else
- STR_rRI(REG_WORK1, R_REGSTRUCT, idx);
-#endif
+ compemu_raw_store_pc_state_from_work1();
popall_execute_normal = get_target();
raw_pop_preserved_regs();
compemu_raw_jmp((uintptr)execute_normal);
popall_check_checksum_setpc = get_target();
-#if defined(CPU_AARCH64)
- STR_xXi(REG_WORK1, R_REGSTRUCT, idx);
-#else
- STR_rRI(REG_WORK1, R_REGSTRUCT, idx);
-#endif
+ compemu_raw_store_pc_state_from_work1();
popall_check_checksum = get_target();
raw_pop_preserved_regs();
compemu_raw_jmp((uintptr)check_checksum);
popall_exec_nostats_setpc = get_target();
-#if defined(CPU_AARCH64)
- STR_xXi(REG_WORK1, R_REGSTRUCT, idx);
-#else
- STR_rRI(REG_WORK1, R_REGSTRUCT, idx);
-#endif
+ compemu_raw_store_pc_state_from_work1();
raw_pop_preserved_regs();
compemu_raw_jmp((uintptr)exec_nostats);