Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port; Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX); Finished the 586MC1; Added 8087 emulation; Moved Cyrix 6x86'es to the Dev branch; Sanitized/cleaned up memregs.c/h and intel.c/h; Split the chipsets from machines and sanitized Port 92 emulation; Added support for the 15bpp mode to the Compaq ATI 28800; Moved the MR 386DX and 486 machines to the Dev branch; Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00; Ported the new timer code from PCem; Cleaned up the CPU table of unused stuff and better optimized its structure; Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch; Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem; Added the AHA-1540A and the BusTek BT-542B; Moved the Sumo SCSI-AT to the Dev branch; Minor IDE, FDC, and floppy drive code clean-ups; Made NCR 5380/53C400-based cards' BIOS address configurable; Got rid of the legacy romset variable; Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit; Added the Amstead PPC512 per PCem patch by John Elliott; Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages); Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing; Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem; Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit; Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement; Amstrad MegaPC does now works correctly with non-internal graphics card; The SLiRP code no longer casts a packed struct type to a non-packed struct type; The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present; The S3 Virge on BeOS is no longer broken (was broken by build #1591); OS/2 2.0 build 6.167 now sees key presses again; Xi8088 now work on CGA again; 86F images converted from either the old or new variants of the HxC MFM format now work correctly; Hardware interrupts with a vector of 0xFF are now handled correctly; OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct; Fixed VNC keyboard input bugs; Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver; Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly; Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4; Compaq Portable now works with all graphics cards; Fixed various MDSI Genius bugs; Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly; Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355; OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400. Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391. Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389. Fixed a minor IDE timing bug, fixes #388. Fixed Toshiba T1000 RAM issues, fixes #379. Fixed EGA/(S)VGA overscan border handling, fixes #378; Got rid of the now long useless IDE channel 2 auto-removal, fixes #370; Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366; Ported the Unicode CD image file name fix from VARCem, fixes #365; Fixed high density floppy disks on the Xi8088, fixes #359; Fixed some bugs in the Hercules emulation, fixes #346, fixes #358; Fixed the SCSI hard disk mode sense pages, fixes #356; Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349; Fixed bugs in the serial mouse emulation, fixes #344; Compiled 86Box binaries now include all the required .DLL's, fixes #341; Made some combo boxes in the Settings dialog slightly wider, fixes #276.
This commit is contained in:
391
src/cpu_new/codegen_backend_x86-64.c
Normal file
391
src/cpu_new/codegen_backend_x86-64.c
Normal file
@@ -0,0 +1,391 @@
|
||||
#ifdef __amd64__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../86box.h"
|
||||
#include "cpu.h"
|
||||
#include "../mem.h"
|
||||
|
||||
#include "codegen.h"
|
||||
#include "codegen_allocator.h"
|
||||
#include "codegen_backend.h"
|
||||
#include "codegen_backend_x86-64_defs.h"
|
||||
#include "codegen_backend_x86-64_ops.h"
|
||||
#include "codegen_backend_x86-64_ops_sse.h"
|
||||
#include "codegen_reg.h"
|
||||
#include "x86.h"
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if defined WIN32 || defined _WIN32 || defined _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
void *codegen_mem_load_byte;
|
||||
void *codegen_mem_load_word;
|
||||
void *codegen_mem_load_long;
|
||||
void *codegen_mem_load_quad;
|
||||
void *codegen_mem_load_single;
|
||||
void *codegen_mem_load_double;
|
||||
|
||||
void *codegen_mem_store_byte;
|
||||
void *codegen_mem_store_word;
|
||||
void *codegen_mem_store_long;
|
||||
void *codegen_mem_store_quad;
|
||||
void *codegen_mem_store_single;
|
||||
void *codegen_mem_store_double;
|
||||
|
||||
void *codegen_gpf_rout;
|
||||
void *codegen_exit_rout;
|
||||
|
||||
host_reg_def_t codegen_host_reg_list[CODEGEN_HOST_REGS] =
|
||||
{
|
||||
/*Note: while EAX and EDX are normally volatile registers under x86
|
||||
calling conventions, the recompiler will explicitly save and restore
|
||||
them across funcion calls*/
|
||||
{REG_EAX, 0},
|
||||
{REG_EBX, 0},
|
||||
{REG_EDX, 0}
|
||||
};
|
||||
|
||||
host_reg_def_t codegen_host_fp_reg_list[CODEGEN_HOST_FP_REGS] =
|
||||
{
|
||||
#if WIN64
|
||||
/*Windows x86-64 calling convention preserves XMM6-XMM15*/
|
||||
{REG_XMM6, 0},
|
||||
{REG_XMM7, 0},
|
||||
#else
|
||||
/*System V AMD64 calling convention does not preserve any XMM registers*/
|
||||
{REG_XMM6, HOST_REG_FLAG_VOLATILE},
|
||||
{REG_XMM7, HOST_REG_FLAG_VOLATILE},
|
||||
#endif
|
||||
{REG_XMM1, HOST_REG_FLAG_VOLATILE},
|
||||
{REG_XMM2, HOST_REG_FLAG_VOLATILE},
|
||||
{REG_XMM3, HOST_REG_FLAG_VOLATILE},
|
||||
{REG_XMM4, HOST_REG_FLAG_VOLATILE},
|
||||
{REG_XMM5, HOST_REG_FLAG_VOLATILE}
|
||||
};
|
||||
|
||||
static void build_load_routine(codeblock_t *block, int size, int is_float)
|
||||
{
|
||||
uint8_t *branch_offset;
|
||||
uint8_t *misaligned_offset;
|
||||
|
||||
/*In - ESI = address
|
||||
Out - ECX = data, ESI = abrt*/
|
||||
/*MOV ECX, ESI
|
||||
SHR ESI, 12
|
||||
MOV RSI, [readlookup2+ESI*4]
|
||||
CMP ESI, -1
|
||||
JNZ +
|
||||
MOVZX ECX, B[RSI+RCX]
|
||||
XOR ESI,ESI
|
||||
RET
|
||||
* PUSH EAX
|
||||
PUSH EDX
|
||||
PUSH ECX
|
||||
CALL readmembl
|
||||
POP ECX
|
||||
POP EDX
|
||||
POP EAX
|
||||
MOVZX ECX, AL
|
||||
RET
|
||||
*/
|
||||
host_x86_MOV32_REG_REG(block, REG_ECX, REG_ESI);
|
||||
host_x86_SHR32_IMM(block, REG_ESI, 12);
|
||||
host_x86_MOV64_REG_IMM(block, REG_RDI, (uint64_t)(uintptr_t)readlookup2);
|
||||
host_x86_MOV64_REG_BASE_INDEX_SHIFT(block, REG_RSI, REG_RDI, REG_RSI, 3);
|
||||
if (size != 1)
|
||||
{
|
||||
host_x86_TEST32_REG_IMM(block, REG_ECX, size-1);
|
||||
misaligned_offset = host_x86_JNZ_short(block);
|
||||
}
|
||||
host_x86_CMP64_REG_IMM(block, REG_RSI, (uint32_t)-1);
|
||||
branch_offset = host_x86_JZ_short(block);
|
||||
if (size == 1 && !is_float)
|
||||
host_x86_MOVZX_BASE_INDEX_32_8(block, REG_ECX, REG_RSI, REG_RCX);
|
||||
else if (size == 2 && !is_float)
|
||||
host_x86_MOVZX_BASE_INDEX_32_16(block, REG_ECX, REG_RSI, REG_RCX);
|
||||
else if (size == 4 && !is_float)
|
||||
host_x86_MOV32_REG_BASE_INDEX(block, REG_ECX, REG_RSI, REG_RCX);
|
||||
else if (size == 4 && is_float)
|
||||
host_x86_CVTSS2SD_XREG_BASE_INDEX(block, REG_XMM_TEMP, REG_RSI, REG_RCX);
|
||||
else if (size == 8)
|
||||
host_x86_MOVQ_XREG_BASE_INDEX(block, REG_XMM_TEMP, REG_RSI, REG_RCX);
|
||||
else
|
||||
fatal("build_load_routine: size=%i\n", size);
|
||||
host_x86_XOR32_REG_REG(block, REG_ESI, REG_ESI);
|
||||
host_x86_RET(block);
|
||||
|
||||
*branch_offset = (uint8_t)((uintptr_t)&block_write_data[block_pos] - (uintptr_t)branch_offset) - 1;
|
||||
if (size != 1)
|
||||
*misaligned_offset = (uint8_t)((uintptr_t)&block_write_data[block_pos] - (uintptr_t)misaligned_offset) - 1;
|
||||
host_x86_PUSH(block, REG_RAX);
|
||||
host_x86_PUSH(block, REG_RDX);
|
||||
#if WIN64
|
||||
host_x86_SUB64_REG_IMM(block, REG_RSP, 0x20);
|
||||
//host_x86_MOV32_REG_REG(block, REG_ECX, uop->imm_data);
|
||||
#else
|
||||
host_x86_MOV32_REG_REG(block, REG_EDI, REG_ECX);
|
||||
#endif
|
||||
if (size == 1 && !is_float)
|
||||
{
|
||||
host_x86_CALL(block, (void *)readmembl);
|
||||
host_x86_MOVZX_REG_32_8(block, REG_ECX, REG_EAX);
|
||||
}
|
||||
else if (size == 2 && !is_float)
|
||||
{
|
||||
host_x86_CALL(block, (void *)readmemwl);
|
||||
host_x86_MOVZX_REG_32_16(block, REG_ECX, REG_EAX);
|
||||
}
|
||||
else if (size == 4 && !is_float)
|
||||
{
|
||||
host_x86_CALL(block, (void *)readmemll);
|
||||
host_x86_MOV32_REG_REG(block, REG_ECX, REG_EAX);
|
||||
}
|
||||
else if (size == 4 && is_float)
|
||||
{
|
||||
host_x86_CALL(block, (void *)readmemll);
|
||||
host_x86_MOVD_XREG_REG(block, REG_XMM_TEMP, REG_EAX);
|
||||
host_x86_CVTSS2SD_XREG_XREG(block, REG_XMM_TEMP, REG_XMM_TEMP);
|
||||
}
|
||||
else if (size == 8)
|
||||
{
|
||||
host_x86_CALL(block, (void *)readmemql);
|
||||
host_x86_MOVQ_XREG_REG(block, REG_XMM_TEMP, REG_RAX);
|
||||
}
|
||||
#if WIN64
|
||||
host_x86_ADD64_REG_IMM(block, REG_RSP, 0x20);
|
||||
#endif
|
||||
host_x86_POP(block, REG_RDX);
|
||||
host_x86_POP(block, REG_RAX);
|
||||
host_x86_MOVZX_REG_ABS_32_8(block, REG_ESI, &cpu_state.abrt);
|
||||
host_x86_RET(block);
|
||||
}
|
||||
|
||||
static void build_store_routine(codeblock_t *block, int size, int is_float)
|
||||
{
|
||||
uint8_t *branch_offset;
|
||||
uint8_t *misaligned_offset;
|
||||
|
||||
/*In - ECX = data, ESI = address
|
||||
Out - ESI = abrt
|
||||
Corrupts EDI*/
|
||||
/*MOV EDI, ESI
|
||||
SHR ESI, 12
|
||||
MOV ESI, [writelookup2+ESI*4]
|
||||
CMP ESI, -1
|
||||
JNZ +
|
||||
MOV [RSI+RDI], ECX
|
||||
XOR ESI,ESI
|
||||
RET
|
||||
* PUSH EAX
|
||||
PUSH EDX
|
||||
PUSH ECX
|
||||
CALL writemembl
|
||||
POP ECX
|
||||
POP EDX
|
||||
POP EAX
|
||||
MOVZX ECX, AL
|
||||
RET
|
||||
*/
|
||||
host_x86_MOV32_REG_REG(block, REG_EDI, REG_ESI);
|
||||
host_x86_SHR32_IMM(block, REG_ESI, 12);
|
||||
host_x86_MOV64_REG_IMM(block, REG_R8, (uint64_t)(uintptr_t)writelookup2);
|
||||
host_x86_MOV64_REG_BASE_INDEX_SHIFT(block, REG_RSI, REG_R8, REG_RSI, 3);
|
||||
if (size != 1)
|
||||
{
|
||||
host_x86_TEST32_REG_IMM(block, REG_EDI, size-1);
|
||||
misaligned_offset = host_x86_JNZ_short(block);
|
||||
}
|
||||
host_x86_CMP64_REG_IMM(block, REG_RSI, (uint32_t)-1);
|
||||
branch_offset = host_x86_JZ_short(block);
|
||||
if (size == 1 && !is_float)
|
||||
host_x86_MOV8_BASE_INDEX_REG(block, REG_RSI, REG_RDI, REG_ECX);
|
||||
else if (size == 2 && !is_float)
|
||||
host_x86_MOV16_BASE_INDEX_REG(block, REG_RSI, REG_RDI, REG_ECX);
|
||||
else if (size == 4 && !is_float)
|
||||
host_x86_MOV32_BASE_INDEX_REG(block, REG_RSI, REG_RDI, REG_ECX);
|
||||
else if (size == 4 && is_float)
|
||||
host_x86_MOVD_BASE_INDEX_XREG(block, REG_RSI, REG_RDI, REG_XMM_TEMP);
|
||||
else if (size == 8)
|
||||
host_x86_MOVQ_BASE_INDEX_XREG(block, REG_RSI, REG_RDI, REG_XMM_TEMP);
|
||||
else
|
||||
fatal("build_store_routine: size=%i\n", size);
|
||||
host_x86_XOR32_REG_REG(block, REG_ESI, REG_ESI);
|
||||
host_x86_RET(block);
|
||||
|
||||
*branch_offset = (uint8_t)((uintptr_t)&block_write_data[block_pos] - (uintptr_t)branch_offset) - 1;
|
||||
if (size != 1)
|
||||
*misaligned_offset = (uint8_t)((uintptr_t)&block_write_data[block_pos] - (uintptr_t)misaligned_offset) - 1;
|
||||
host_x86_PUSH(block, REG_RAX);
|
||||
host_x86_PUSH(block, REG_RDX);
|
||||
#if WIN64
|
||||
host_x86_SUB64_REG_IMM(block, REG_RSP, 0x28);
|
||||
if (size == 4 && is_float)
|
||||
host_x86_MOVD_REG_XREG(block, REG_EDX, REG_XMM_TEMP); //data
|
||||
else if (size == 8)
|
||||
host_x86_MOVQ_REG_XREG(block, REG_RDX, REG_XMM_TEMP); //data
|
||||
else
|
||||
host_x86_MOV32_REG_REG(block, REG_EDX, REG_ECX); //data
|
||||
host_x86_MOV32_REG_REG(block, REG_ECX, REG_EDI); //address
|
||||
#else
|
||||
host_x86_SUB64_REG_IMM(block, REG_RSP, 0x8);
|
||||
//host_x86_MOV32_REG_REG(block, REG_EDI, REG_ECX); //address
|
||||
if (size == 4 && is_float)
|
||||
host_x86_MOVD_REG_XREG(block, REG_ESI, REG_XMM_TEMP); //data
|
||||
else if (size == 8)
|
||||
host_x86_MOVQ_REG_XREG(block, REG_RSI, REG_XMM_TEMP); //data
|
||||
else
|
||||
host_x86_MOV32_REG_REG(block, REG_ESI, REG_ECX); //data
|
||||
#endif
|
||||
if (size == 1)
|
||||
host_x86_CALL(block, (void *)writemembl);
|
||||
else if (size == 2)
|
||||
host_x86_CALL(block, (void *)writememwl);
|
||||
else if (size == 4)
|
||||
host_x86_CALL(block, (void *)writememll);
|
||||
else if (size == 8)
|
||||
host_x86_CALL(block, (void *)writememql);
|
||||
#if WIN64
|
||||
host_x86_ADD64_REG_IMM(block, REG_RSP, 0x28);
|
||||
#else
|
||||
host_x86_ADD64_REG_IMM(block, REG_RSP, 0x8);
|
||||
#endif
|
||||
host_x86_POP(block, REG_RDX);
|
||||
host_x86_POP(block, REG_RAX);
|
||||
host_x86_MOVZX_REG_ABS_32_8(block, REG_ESI, &cpu_state.abrt);
|
||||
host_x86_RET(block);
|
||||
}
|
||||
|
||||
static void build_loadstore_routines(codeblock_t *block)
|
||||
{
|
||||
codegen_mem_load_byte = &codeblock[block_current].data[block_pos];
|
||||
build_load_routine(block, 1, 0);
|
||||
codegen_mem_load_word = &codeblock[block_current].data[block_pos];
|
||||
build_load_routine(block, 2, 0);
|
||||
codegen_mem_load_long = &codeblock[block_current].data[block_pos];
|
||||
build_load_routine(block, 4, 0);
|
||||
codegen_mem_load_quad = &codeblock[block_current].data[block_pos];
|
||||
build_load_routine(block, 8, 0);
|
||||
codegen_mem_load_single = &codeblock[block_current].data[block_pos];
|
||||
build_load_routine(block, 4, 1);
|
||||
codegen_mem_load_double = &codeblock[block_current].data[block_pos];
|
||||
build_load_routine(block, 8, 1);
|
||||
|
||||
codegen_mem_store_byte = &codeblock[block_current].data[block_pos];
|
||||
build_store_routine(block, 1, 0);
|
||||
codegen_mem_store_word = &codeblock[block_current].data[block_pos];
|
||||
build_store_routine(block, 2, 0);
|
||||
codegen_mem_store_long = &codeblock[block_current].data[block_pos];
|
||||
build_store_routine(block, 4, 0);
|
||||
codegen_mem_store_quad = &codeblock[block_current].data[block_pos];
|
||||
build_store_routine(block, 8, 0);
|
||||
codegen_mem_store_single = &codeblock[block_current].data[block_pos];
|
||||
build_store_routine(block, 4, 1);
|
||||
codegen_mem_store_double = &codeblock[block_current].data[block_pos];
|
||||
build_store_routine(block, 8, 1);
|
||||
}
|
||||
|
||||
void codegen_backend_init()
|
||||
{
|
||||
codeblock_t *block;
|
||||
int c;
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
void *start;
|
||||
size_t len;
|
||||
long pagesize = sysconf(_SC_PAGESIZE);
|
||||
long pagemask = ~(pagesize - 1);
|
||||
#endif
|
||||
|
||||
codeblock = malloc(BLOCK_SIZE * sizeof(codeblock_t));
|
||||
codeblock_hash = malloc(HASH_SIZE * sizeof(codeblock_t *));
|
||||
|
||||
memset(codeblock, 0, BLOCK_SIZE * sizeof(codeblock_t));
|
||||
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
|
||||
|
||||
for (c = 0; c < BLOCK_SIZE; c++)
|
||||
codeblock[c].pc = BLOCK_PC_INVALID;
|
||||
|
||||
block_current = 0;
|
||||
block_pos = 0;
|
||||
block = &codeblock[block_current];
|
||||
codeblock[block_current].head_mem_block = codegen_allocator_allocate(NULL, block_current);
|
||||
codeblock[block_current].data = codeblock_allocator_get_ptr(codeblock[block_current].head_mem_block);
|
||||
block_write_data = codeblock[block_current].data;
|
||||
build_loadstore_routines(&codeblock[block_current]);
|
||||
|
||||
codegen_gpf_rout = &codeblock[block_current].data[block_pos];
|
||||
#if WIN64
|
||||
host_x86_XOR32_REG_REG(block, REG_ECX, REG_ECX);
|
||||
host_x86_XOR32_REG_REG(block, REG_EDX, REG_EDX);
|
||||
#else
|
||||
host_x86_XOR32_REG_REG(block, REG_EDI, REG_EDI);
|
||||
host_x86_XOR32_REG_REG(block, REG_ESI, REG_ESI);
|
||||
#endif
|
||||
/* host_x86_CALL(block, (uintptr_t)x86gpf); */
|
||||
host_x86_CALL(block, (void *)x86gpf);
|
||||
codegen_exit_rout = &codeblock[block_current].data[block_pos];
|
||||
host_x86_ADD64_REG_IMM(block, REG_RSP, 0x38);
|
||||
host_x86_POP(block, REG_R15);
|
||||
host_x86_POP(block, REG_R14);
|
||||
host_x86_POP(block, REG_R13);
|
||||
host_x86_POP(block, REG_R12);
|
||||
host_x86_POP(block, REG_RDI);
|
||||
host_x86_POP(block, REG_RSI);
|
||||
host_x86_POP(block, REG_RBP);
|
||||
host_x86_POP(block, REG_RDX);
|
||||
host_x86_RET(block);
|
||||
|
||||
block_write_data = NULL;
|
||||
|
||||
asm(
|
||||
"stmxcsr %0\n"
|
||||
: "=m" (cpu_state.old_fp_control)
|
||||
);
|
||||
cpu_state.trunc_fp_control = cpu_state.old_fp_control | 0x6000;
|
||||
}
|
||||
|
||||
void codegen_set_rounding_mode(int mode)
|
||||
{
|
||||
cpu_state.new_fp_control = (cpu_state.old_fp_control & ~0x6000) | (mode << 13);
|
||||
}
|
||||
|
||||
void codegen_backend_prologue(codeblock_t *block)
|
||||
{
|
||||
block_pos = BLOCK_START; /*Entry code*/
|
||||
host_x86_PUSH(block, REG_RBX);
|
||||
host_x86_PUSH(block, REG_RBP);
|
||||
host_x86_PUSH(block, REG_RSI);
|
||||
host_x86_PUSH(block, REG_RDI);
|
||||
host_x86_PUSH(block, REG_R12);
|
||||
host_x86_PUSH(block, REG_R13);
|
||||
host_x86_PUSH(block, REG_R14);
|
||||
host_x86_PUSH(block, REG_R15);
|
||||
host_x86_SUB64_REG_IMM(block, REG_RSP, 0x38);
|
||||
host_x86_MOV64_REG_IMM(block, REG_RBP, ((uintptr_t)&cpu_state) + 128);
|
||||
if (block->flags & CODEBLOCK_HAS_FPU)
|
||||
{
|
||||
host_x86_MOV32_REG_ABS(block, REG_EAX, &cpu_state.TOP);
|
||||
host_x86_SUB32_REG_IMM(block, REG_EAX, block->TOP);
|
||||
host_x86_MOV32_BASE_OFFSET_REG(block, REG_RSP, IREG_TOP_diff_stack_offset, REG_EAX);
|
||||
}
|
||||
if (block->flags & CODEBLOCK_NO_IMMEDIATES)
|
||||
host_x86_MOV64_REG_IMM(block, REG_R12, (uintptr_t)ram);
|
||||
}
|
||||
|
||||
void codegen_backend_epilogue(codeblock_t *block)
|
||||
{
|
||||
host_x86_ADD64_REG_IMM(block, REG_RSP, 0x38);
|
||||
host_x86_POP(block, REG_R15);
|
||||
host_x86_POP(block, REG_R14);
|
||||
host_x86_POP(block, REG_R13);
|
||||
host_x86_POP(block, REG_R12);
|
||||
host_x86_POP(block, REG_RDI);
|
||||
host_x86_POP(block, REG_RSI);
|
||||
host_x86_POP(block, REG_RBP);
|
||||
host_x86_POP(block, REG_RDX);
|
||||
host_x86_RET(block);
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user