One last attempt at a fix to my own GPF handler.

This commit is contained in:
OBattler
2022-10-27 04:10:16 +02:00
parent 4dc74515e8
commit bff5026b8b
4 changed files with 7 additions and 6 deletions

View File

@@ -281,7 +281,7 @@ void codegen_block_start_recompile(codeblock_t *block)
block->status = cpu_cur_status;
block_pos = BLOCK_GPF_OFFSET;
#ifndef NEW_GPF
#ifdef OLD_GPF
#if _WIN64
addbyte(0x48); /*XOR RCX, RCX*/
addbyte(0x31);
@@ -306,8 +306,8 @@ void codegen_block_start_recompile(codeblock_t *block)
addbyte(0x31); /* xor eax,eax */
addbyte(0xc0);
addbyte(0x89); /*MOVB eax,(abrt_error)*/
addbyte(0x05);
rip_rel = (uintptr_t) &(codeblock[block_current].data[block_pos]);
addbyte(0x85);
rip_rel = ((uintptr_t)&cpu_state) + 128;
rip_rel = ((uintptr_t) &(abrt_error)) - rip_rel;
addlong((uint32_t) rip_rel);
#endif

View File

@@ -8,7 +8,7 @@
#define HASH(l) ((l) & 0x1ffff)
#define BLOCK_EXIT_OFFSET 0x7e0
#ifndef NEW_GPF
#ifdef OLD_GPF
#define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 20)
#else
#define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 12)