Changed GPF handled on the 64-bit old recompiler.
This commit is contained in:
@@ -267,6 +267,7 @@ void codegen_block_init(uint32_t phys_addr)
|
|||||||
void codegen_block_start_recompile(codeblock_t *block)
|
void codegen_block_start_recompile(codeblock_t *block)
|
||||||
{
|
{
|
||||||
page_t *page = &pages[block->phys >> 12];
|
page_t *page = &pages[block->phys >> 12];
|
||||||
|
uintptr_t rip_rel;
|
||||||
|
|
||||||
if (!page->block[(block->phys >> 10) & 3])
|
if (!page->block[(block->phys >> 10) & 3])
|
||||||
mem_flush_write_page(block->phys, cs+cpu_state.pc);
|
mem_flush_write_page(block->phys, cs+cpu_state.pc);
|
||||||
@@ -298,15 +299,17 @@ void codegen_block_start_recompile(codeblock_t *block)
|
|||||||
while (block_pos < BLOCK_EXIT_OFFSET)
|
while (block_pos < BLOCK_EXIT_OFFSET)
|
||||||
addbyte(0x90); /*NOP*/
|
addbyte(0x90); /*NOP*/
|
||||||
#else
|
#else
|
||||||
addbyte(0xc6); /* mov byte ptr[&(cpu_state.abrt)],ABRT_GPF */
|
addbyte(0xC6); /*MOVB ABRT_GPF,(abrt)*/
|
||||||
addbyte(0x05);
|
addbyte(0x45);
|
||||||
addlong((uint32_t) (uintptr_t) &(cpu_state.abrt));
|
addbyte((uint8_t)cpu_state_offset(abrt));
|
||||||
addbyte(ABRT_GPF);
|
addbyte(ABRT_GPF);
|
||||||
addbyte(0x31); /* xor eax,eax */
|
addbyte(0x31); /* xor eax,eax */
|
||||||
addbyte(0xc0);
|
addbyte(0xc0);
|
||||||
addbyte(0x67); /* mov [&(abrt_error)],eax */
|
addbyte(0x89); /*MOVB eax,(abrt_error)*/
|
||||||
addbyte(0xa3);
|
addbyte(0x05);
|
||||||
addlong((uint32_t) (uintptr_t) &(abrt_error));
|
rip_rel = (uintptr_t) &(codeblock[block_current].data[block_pos]);
|
||||||
|
rip_rel = ((uintptr_t) &(abrt_error)) - rip_rel;
|
||||||
|
addlong((uint32_t) rip_rel);
|
||||||
#endif
|
#endif
|
||||||
block_pos = BLOCK_EXIT_OFFSET; /*Exit code*/
|
block_pos = BLOCK_EXIT_OFFSET; /*Exit code*/
|
||||||
addbyte(0x48); /*ADDL $40,%rsp*/
|
addbyte(0x48); /*ADDL $40,%rsp*/
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#ifdef OLD_GPF
|
#ifdef OLD_GPF
|
||||||
#define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 20)
|
#define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 20)
|
||||||
#else
|
#else
|
||||||
#define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 15)
|
#define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 12)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BLOCK_MAX 1620
|
#define BLOCK_MAX 1620
|
||||||
|
|||||||
Reference in New Issue
Block a user