Merge pull request #1632 from 86Box/master
Bring the branch up to par with master.
This commit is contained in:
@@ -253,7 +253,10 @@ cdrom_image_open(cdrom_t *dev, const char *fn)
|
|||||||
{
|
{
|
||||||
cd_img_t *img;
|
cd_img_t *img;
|
||||||
|
|
||||||
strcpy(dev->image_path, fn);
|
/* Make sure to not STRCPY if the two are pointing
|
||||||
|
at the same place. */
|
||||||
|
if (fn != dev->image_path)
|
||||||
|
strcpy(dev->image_path, fn);
|
||||||
|
|
||||||
/* Create new instance of the CDROM_Image class. */
|
/* Create new instance of the CDROM_Image class. */
|
||||||
img = (cd_img_t *) malloc(sizeof(cd_img_t));
|
img = (cd_img_t *) malloc(sizeof(cd_img_t));
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ bin_get_length(void *p)
|
|||||||
off64_t len;
|
off64_t len;
|
||||||
track_file_t *tf = (track_file_t *) p;
|
track_file_t *tf = (track_file_t *) p;
|
||||||
|
|
||||||
cdrom_image_backend_log("CDROM: binary_length(%08lx)\n", bf->file);
|
cdrom_image_backend_log("CDROM: binary_length(%08lx)\n", tf->file);
|
||||||
|
|
||||||
if (tf->file == NULL)
|
if (tf->file == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -48,11 +48,16 @@ void codegen_accumulate(int acc_reg, int delta)
|
|||||||
void codegen_accumulate_flush(void)
|
void codegen_accumulate_flush(void)
|
||||||
{
|
{
|
||||||
if (acc_regs[0].count) {
|
if (acc_regs[0].count) {
|
||||||
addbyte(0x81); /*ADD $acc_regs[0].count,acc_regs[0].dest*/
|
addbyte(0x55); /*push rbp*/
|
||||||
addbyte(0x04);
|
addbyte(0x48); /*mov rbp,val*/
|
||||||
addbyte(0x25);
|
addbyte(0xbd);
|
||||||
addlong((uint32_t) acc_regs[0].dest_reg);
|
addlong((uint32_t) (acc_regs[0].dest_reg & 0xffffffffULL));
|
||||||
|
addlong((uint32_t) (acc_regs[0].dest_reg >> 32ULL));
|
||||||
|
addbyte(0x81); /* add d,[rbp][0],val */
|
||||||
|
addbyte(0x45);
|
||||||
|
addbyte(0x00);
|
||||||
addlong(acc_regs[0].count);
|
addlong(acc_regs[0].count);
|
||||||
|
addbyte(0x5d); /*pop rbp*/
|
||||||
}
|
}
|
||||||
|
|
||||||
acc_regs[0].count = 0;
|
acc_regs[0].count = 0;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#if defined(__linux__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined WIN32 || defined _WIN32 || defined _WIN32
|
#if defined WIN32 || defined _WIN32 || defined _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -35,6 +36,10 @@ void codegen_allocator_init()
|
|||||||
|
|
||||||
#if defined WIN32 || defined _WIN32 || defined _WIN32
|
#if defined WIN32 || defined _WIN32 || defined _WIN32
|
||||||
mem_block_alloc = VirtualAlloc(NULL, MEM_BLOCK_NR * MEM_BLOCK_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
mem_block_alloc = VirtualAlloc(NULL, MEM_BLOCK_NR * MEM_BLOCK_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||||
|
/* TODO: check deployment target: older Intel-based versions of macOS don't play
|
||||||
|
nice with MAP_JIT. */
|
||||||
|
#elif defined(__APPLE__) && defined(MAP_JIT)
|
||||||
|
mem_block_alloc = mmap(0, MEM_BLOCK_NR * MEM_BLOCK_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE|MAP_JIT, 0, 0);
|
||||||
#else
|
#else
|
||||||
mem_block_alloc = mmap(0, MEM_BLOCK_NR * MEM_BLOCK_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, 0, 0);
|
mem_block_alloc = mmap(0, MEM_BLOCK_NR * MEM_BLOCK_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
@@ -115,11 +120,7 @@ void codegen_allocator_clean_blocks(struct mem_block_t *block)
|
|||||||
#if defined __ARM_EABI__ || defined _ARM_ || defined __aarch64__ || defined _M_ARM || defined _M_ARM64
|
#if defined __ARM_EABI__ || defined _ARM_ || defined __aarch64__ || defined _M_ARM || defined _M_ARM64
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
#ifndef _MSC_VER
|
|
||||||
__clear_cache(&mem_block_alloc[block->offset], &mem_block_alloc[block->offset + MEM_BLOCK_SIZE]);
|
__clear_cache(&mem_block_alloc[block->offset], &mem_block_alloc[block->offset + MEM_BLOCK_SIZE]);
|
||||||
#else
|
|
||||||
FlushInstructionCache(GetCurrentProcess(), &mem_block_alloc[block->offset], MEM_BLOCK_SIZE);
|
|
||||||
#endif
|
|
||||||
if (block->next)
|
if (block->next)
|
||||||
block = &mem_blocks[block->next - 1];
|
block = &mem_blocks[block->next - 1];
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -327,13 +327,9 @@ printf("block_pos=%i\n", block_pos);
|
|||||||
|
|
||||||
block_write_data = NULL;
|
block_write_data = NULL;
|
||||||
//fatal("block_pos=%i\n", block_pos);
|
//fatal("block_pos=%i\n", block_pos);
|
||||||
#if !defined _MSC_VER || defined __clang__
|
|
||||||
asm("vmrs %0, fpscr\n"
|
asm("vmrs %0, fpscr\n"
|
||||||
: "=r" (cpu_state.old_fp_control)
|
: "=r" (cpu_state.old_fp_control)
|
||||||
);
|
);
|
||||||
#else
|
|
||||||
cpu_state.old_fp_control = _controlfp();
|
|
||||||
#endif
|
|
||||||
if ((cpu_state.old_fp_control >> 22) & 3)
|
if ((cpu_state.old_fp_control >> 22) & 3)
|
||||||
fatal("VFP not in nearest rounding mode\n");
|
fatal("VFP not in nearest rounding mode\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -332,13 +332,9 @@ void codegen_backend_init()
|
|||||||
|
|
||||||
codegen_allocator_clean_blocks(block->head_mem_block);
|
codegen_allocator_clean_blocks(block->head_mem_block);
|
||||||
|
|
||||||
#if !defined _MSC_VER || defined __clang__
|
|
||||||
asm("mrs %0, fpcr\n"
|
asm("mrs %0, fpcr\n"
|
||||||
: "=r" (cpu_state.old_fp_control)
|
: "=r" (cpu_state.old_fp_control)
|
||||||
);
|
);
|
||||||
#else
|
|
||||||
cpu_state.old_fp_control = _controlfp();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void codegen_set_rounding_mode(int mode)
|
void codegen_set_rounding_mode(int mode)
|
||||||
|
|||||||
@@ -913,8 +913,8 @@ static int codegen_MMX_ENTER(codeblock_t *block, uop_t *uop)
|
|||||||
*branch_ptr |= ((((uintptr_t)&block_write_data[block_pos] - (uintptr_t)branch_ptr) - 8) & 0x3fffffc) >> 2;
|
*branch_ptr |= ((((uintptr_t)&block_write_data[block_pos] - (uintptr_t)branch_ptr) - 8) & 0x3fffffc) >> 2;
|
||||||
|
|
||||||
host_arm_MOV_IMM(block, REG_TEMP, 0x01010101);
|
host_arm_MOV_IMM(block, REG_TEMP, 0x01010101);
|
||||||
host_arm_STR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t)&cpu_state.tag[0] - (uintptr_t)&cpu_state);
|
host_arm_STR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t)&cpu_state.tag[0] - (uintptr_t)&cpu_state);
|
||||||
host_arm_STR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t)&cpu_state.tag[4] - (uintptr_t)&cpu_state);
|
host_arm_STR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t)&cpu_state.tag[4] - (uintptr_t)&cpu_state);
|
||||||
host_arm_MOV_IMM(block, REG_TEMP, 0);
|
host_arm_MOV_IMM(block, REG_TEMP, 0);
|
||||||
host_arm_STR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t)&cpu_state.TOP - (uintptr_t)&cpu_state);
|
host_arm_STR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t)&cpu_state.TOP - (uintptr_t)&cpu_state);
|
||||||
host_arm_STRB_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t)&cpu_state.ismmx - (uintptr_t)&cpu_state);
|
host_arm_STRB_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t)&cpu_state.ismmx - (uintptr_t)&cpu_state);
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <xmmintrin.h>
|
|
||||||
|
|
||||||
void *codegen_mem_load_byte;
|
void *codegen_mem_load_byte;
|
||||||
void *codegen_mem_load_word;
|
void *codegen_mem_load_word;
|
||||||
void *codegen_mem_load_long;
|
void *codegen_mem_load_long;
|
||||||
@@ -326,7 +324,6 @@ void codegen_backend_init()
|
|||||||
host_x86_XOR32_REG_REG(block, REG_EDI, REG_EDI);
|
host_x86_XOR32_REG_REG(block, REG_EDI, REG_EDI);
|
||||||
host_x86_XOR32_REG_REG(block, REG_ESI, REG_ESI);
|
host_x86_XOR32_REG_REG(block, REG_ESI, REG_ESI);
|
||||||
#endif
|
#endif
|
||||||
/* host_x86_CALL(block, (uintptr_t)x86gpf); */
|
|
||||||
host_x86_CALL(block, (void *)x86gpf);
|
host_x86_CALL(block, (void *)x86gpf);
|
||||||
codegen_exit_rout = &codeblock[block_current].data[block_pos];
|
codegen_exit_rout = &codeblock[block_current].data[block_pos];
|
||||||
host_x86_ADD64_REG_IMM(block, REG_RSP, 0x38);
|
host_x86_ADD64_REG_IMM(block, REG_RSP, 0x38);
|
||||||
@@ -342,7 +339,11 @@ void codegen_backend_init()
|
|||||||
|
|
||||||
block_write_data = NULL;
|
block_write_data = NULL;
|
||||||
|
|
||||||
cpu_state.trunc_fp_control = _mm_getcsr() | 0x6000;
|
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)
|
void codegen_set_rounding_mode(int mode)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
#define REG_XMM6 6
|
#define REG_XMM6 6
|
||||||
#define REG_XMM7 7
|
#define REG_XMM7 7
|
||||||
|
|
||||||
#define REG_XMM_TEMP REG_XMM7
|
#define REG_XMM_TEMP REG_XMM0
|
||||||
|
|
||||||
#define CODEGEN_HOST_REGS 3
|
#define CODEGEN_HOST_REGS 3
|
||||||
#define CODEGEN_HOST_FP_REGS 7
|
#define CODEGEN_HOST_FP_REGS 7
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ static inline void call(codeblock_t *block, uintptr_t func)
|
|||||||
codegen_alloc_bytes(block, 5);
|
codegen_alloc_bytes(block, 5);
|
||||||
diff = func - (uintptr_t)&block_write_data[block_pos + 5];
|
diff = func - (uintptr_t)&block_write_data[block_pos + 5];
|
||||||
|
|
||||||
if (diff >= -0x80000000ULL && diff < 0x7fffffffULL)
|
if (diff >= -0x80000000 && diff < 0x7fffffff)
|
||||||
{
|
{
|
||||||
codegen_addbyte(block, 0xE8); /*CALL*/
|
codegen_addbyte(block, 0xE8); /*CALL*/
|
||||||
codegen_addlong(block, (uint32_t)diff);
|
codegen_addlong(block, (uint32_t)diff);
|
||||||
@@ -53,7 +53,7 @@ static inline void jmp(codeblock_t *block, uintptr_t func)
|
|||||||
codegen_alloc_bytes(block, 5);
|
codegen_alloc_bytes(block, 5);
|
||||||
diff = func - (uintptr_t)&block_write_data[block_pos + 5];
|
diff = func - (uintptr_t)&block_write_data[block_pos + 5];
|
||||||
|
|
||||||
if (diff >= -0x80000000ULL && diff < 0x7fffffffULL)
|
if (diff >= -0x80000000 && diff < 0x7fffffff)
|
||||||
{
|
{
|
||||||
codegen_addbyte(block, 0xe9); /*JMP*/
|
codegen_addbyte(block, 0xe9); /*JMP*/
|
||||||
codegen_addlong(block, (uint32_t)diff);
|
codegen_addlong(block, (uint32_t)diff);
|
||||||
|
|||||||
@@ -199,9 +199,9 @@ static int codegen_CALL_FUNC(codeblock_t *block, uop_t *uop)
|
|||||||
static int codegen_CALL_FUNC_RESULT(codeblock_t *block, uop_t *uop)
|
static int codegen_CALL_FUNC_RESULT(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
int dest_reg = HOST_REG_GET(uop->dest_reg_a_real);
|
int dest_reg = HOST_REG_GET(uop->dest_reg_a_real);
|
||||||
/* int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real); */
|
|
||||||
|
|
||||||
#ifdef RECOMPILER_DEBUG
|
#ifdef RECOMPILER_DEBUG
|
||||||
|
int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real);
|
||||||
if (!REG_IS_L(dest_size))
|
if (!REG_IS_L(dest_size))
|
||||||
fatal("CALL_FUNC_RESULT %02x\n", uop->dest_reg_a_real);
|
fatal("CALL_FUNC_RESULT %02x\n", uop->dest_reg_a_real);
|
||||||
#endif
|
#endif
|
||||||
@@ -922,9 +922,9 @@ static int codegen_LOAD_FUNC_ARG3_IMM(codeblock_t *block, uop_t *uop)
|
|||||||
static int codegen_LOAD_SEG(codeblock_t *block, uop_t *uop)
|
static int codegen_LOAD_SEG(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
int src_reg = HOST_REG_GET(uop->src_reg_a_real);
|
int src_reg = HOST_REG_GET(uop->src_reg_a_real);
|
||||||
/* int src_size = IREG_GET_SIZE(uop->src_reg_a_real); */
|
|
||||||
|
|
||||||
#ifdef RECOMPILER_DEBUG
|
#ifdef RECOMPILER_DEBUG
|
||||||
|
int src_size = IREG_GET_SIZE(uop->src_reg_a_real);
|
||||||
if (!REG_IS_W(src_size))
|
if (!REG_IS_W(src_size))
|
||||||
fatal("LOAD_SEG %02x %p\n", uop->src_reg_a_real, uop->p);
|
fatal("LOAD_SEG %02x %p\n", uop->src_reg_a_real, uop->p);
|
||||||
#endif
|
#endif
|
||||||
@@ -1033,9 +1033,9 @@ static int codegen_MEM_LOAD_REG(codeblock_t *block, uop_t *uop)
|
|||||||
static int codegen_MEM_LOAD_SINGLE(codeblock_t *block, uop_t *uop)
|
static int codegen_MEM_LOAD_SINGLE(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
int dest_reg = HOST_REG_GET(uop->dest_reg_a_real), seg_reg = HOST_REG_GET(uop->src_reg_a_real), addr_reg = HOST_REG_GET(uop->src_reg_b_real);
|
int dest_reg = HOST_REG_GET(uop->dest_reg_a_real), seg_reg = HOST_REG_GET(uop->src_reg_a_real), addr_reg = HOST_REG_GET(uop->src_reg_b_real);
|
||||||
/* int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real); */
|
|
||||||
|
|
||||||
#ifdef RECOMPILER_DEBUG
|
#ifdef RECOMPILER_DEBUG
|
||||||
|
int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real);
|
||||||
if (!REG_IS_D(dest_size))
|
if (!REG_IS_D(dest_size))
|
||||||
fatal("MEM_LOAD_SINGLE - %02x\n", uop->dest_reg_a_real);
|
fatal("MEM_LOAD_SINGLE - %02x\n", uop->dest_reg_a_real);
|
||||||
#endif
|
#endif
|
||||||
@@ -1052,9 +1052,9 @@ static int codegen_MEM_LOAD_SINGLE(codeblock_t *block, uop_t *uop)
|
|||||||
static int codegen_MEM_LOAD_DOUBLE(codeblock_t *block, uop_t *uop)
|
static int codegen_MEM_LOAD_DOUBLE(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
int dest_reg = HOST_REG_GET(uop->dest_reg_a_real), seg_reg = HOST_REG_GET(uop->src_reg_a_real), addr_reg = HOST_REG_GET(uop->src_reg_b_real);
|
int dest_reg = HOST_REG_GET(uop->dest_reg_a_real), seg_reg = HOST_REG_GET(uop->src_reg_a_real), addr_reg = HOST_REG_GET(uop->src_reg_b_real);
|
||||||
/* int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real); */
|
|
||||||
|
|
||||||
#ifdef RECOMPILER_DEBUG
|
#ifdef RECOMPILER_DEBUG
|
||||||
|
int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real);
|
||||||
if (!REG_IS_D(dest_size))
|
if (!REG_IS_D(dest_size))
|
||||||
fatal("MEM_LOAD_DOUBLE - %02x\n", uop->dest_reg_a_real);
|
fatal("MEM_LOAD_DOUBLE - %02x\n", uop->dest_reg_a_real);
|
||||||
#endif
|
#endif
|
||||||
@@ -1178,9 +1178,9 @@ static int codegen_MEM_STORE_REG(codeblock_t *block, uop_t *uop)
|
|||||||
static int codegen_MEM_STORE_SINGLE(codeblock_t *block, uop_t *uop)
|
static int codegen_MEM_STORE_SINGLE(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
int seg_reg = HOST_REG_GET(uop->src_reg_a_real), addr_reg = HOST_REG_GET(uop->src_reg_b_real), src_reg = HOST_REG_GET(uop->src_reg_c_real);
|
int seg_reg = HOST_REG_GET(uop->src_reg_a_real), addr_reg = HOST_REG_GET(uop->src_reg_b_real), src_reg = HOST_REG_GET(uop->src_reg_c_real);
|
||||||
/* int src_size = IREG_GET_SIZE(uop->src_reg_c_real); */
|
|
||||||
|
|
||||||
#ifdef RECOMPILER_DEBUG
|
#ifdef RECOMPILER_DEBUG
|
||||||
|
int src_size = IREG_GET_SIZE(uop->src_reg_c_real);
|
||||||
if (!REG_IS_D(src_size))
|
if (!REG_IS_D(src_size))
|
||||||
fatal("MEM_STORE_SINGLE - %02x\n", uop->src_reg_b_real);
|
fatal("MEM_STORE_SINGLE - %02x\n", uop->src_reg_b_real);
|
||||||
#endif
|
#endif
|
||||||
@@ -1197,9 +1197,9 @@ static int codegen_MEM_STORE_SINGLE(codeblock_t *block, uop_t *uop)
|
|||||||
static int codegen_MEM_STORE_DOUBLE(codeblock_t *block, uop_t *uop)
|
static int codegen_MEM_STORE_DOUBLE(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
int seg_reg = HOST_REG_GET(uop->src_reg_a_real), addr_reg = HOST_REG_GET(uop->src_reg_b_real), src_reg = HOST_REG_GET(uop->src_reg_c_real);
|
int seg_reg = HOST_REG_GET(uop->src_reg_a_real), addr_reg = HOST_REG_GET(uop->src_reg_b_real), src_reg = HOST_REG_GET(uop->src_reg_c_real);
|
||||||
/* int src_size = IREG_GET_SIZE(uop->src_reg_c_real); */
|
|
||||||
|
|
||||||
#ifdef RECOMPILER_DEBUG
|
#ifdef RECOMPILER_DEBUG
|
||||||
|
int src_size = IREG_GET_SIZE(uop->src_reg_c_real);
|
||||||
if (!REG_IS_D(src_size))
|
if (!REG_IS_D(src_size))
|
||||||
fatal("MEM_STORE_DOUBLE - %02x\n", uop->src_reg_b_real);
|
fatal("MEM_STORE_DOUBLE - %02x\n", uop->src_reg_b_real);
|
||||||
#endif
|
#endif
|
||||||
@@ -1499,7 +1499,7 @@ static int codegen_OR(codeblock_t *block, uop_t *uop)
|
|||||||
}
|
}
|
||||||
static int codegen_OR_IMM(codeblock_t *block, uop_t *uop)
|
static int codegen_OR_IMM(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
int dest_reg = HOST_REG_GET(uop->dest_reg_a_real)/*, src_reg = HOST_REG_GET(uop->src_reg_a_real)*/;
|
int dest_reg = HOST_REG_GET(uop->dest_reg_a_real);
|
||||||
int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real), src_size = IREG_GET_SIZE(uop->src_reg_a_real);
|
int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real), src_size = IREG_GET_SIZE(uop->src_reg_a_real);
|
||||||
|
|
||||||
if (REG_IS_L(dest_size) && REG_IS_L(src_size))
|
if (REG_IS_L(dest_size) && REG_IS_L(src_size))
|
||||||
@@ -2770,7 +2770,7 @@ static int codegen_TEST_JS_DEST(codeblock_t *block, uop_t *uop)
|
|||||||
|
|
||||||
static int codegen_XOR(codeblock_t *block, uop_t *uop)
|
static int codegen_XOR(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
int dest_reg = HOST_REG_GET(uop->dest_reg_a_real)/*, src_reg_a = HOST_REG_GET(uop->src_reg_a_real)*/, src_reg_b = HOST_REG_GET(uop->src_reg_b_real);
|
int dest_reg = HOST_REG_GET(uop->dest_reg_a_real), src_reg_b = HOST_REG_GET(uop->src_reg_b_real);
|
||||||
int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real), src_size_a = IREG_GET_SIZE(uop->src_reg_a_real), src_size_b = IREG_GET_SIZE(uop->src_reg_b_real);
|
int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real), src_size_a = IREG_GET_SIZE(uop->src_reg_a_real), src_size_b = IREG_GET_SIZE(uop->src_reg_b_real);
|
||||||
|
|
||||||
if (REG_IS_Q(dest_size) && REG_IS_Q(src_size_a) && REG_IS_Q(src_size_b) && uop->dest_reg_a_real == uop->src_reg_a_real)
|
if (REG_IS_Q(dest_size) && REG_IS_Q(src_size_a) && REG_IS_Q(src_size_b) && uop->dest_reg_a_real == uop->src_reg_a_real)
|
||||||
@@ -2797,7 +2797,7 @@ static int codegen_XOR(codeblock_t *block, uop_t *uop)
|
|||||||
}
|
}
|
||||||
static int codegen_XOR_IMM(codeblock_t *block, uop_t *uop)
|
static int codegen_XOR_IMM(codeblock_t *block, uop_t *uop)
|
||||||
{
|
{
|
||||||
int dest_reg = HOST_REG_GET(uop->dest_reg_a_real)/*, src_reg = HOST_REG_GET(uop->src_reg_a_real)*/;
|
int dest_reg = HOST_REG_GET(uop->dest_reg_a_real);
|
||||||
int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real), src_size = IREG_GET_SIZE(uop->src_reg_a_real);
|
int dest_size = IREG_GET_SIZE(uop->dest_reg_a_real), src_size = IREG_GET_SIZE(uop->src_reg_a_real);
|
||||||
|
|
||||||
if (REG_IS_L(dest_size) && REG_IS_L(src_size))
|
if (REG_IS_L(dest_size) && REG_IS_L(src_size))
|
||||||
|
|||||||
@@ -304,20 +304,12 @@ void codegen_backend_init()
|
|||||||
block_write_data = NULL;
|
block_write_data = NULL;
|
||||||
|
|
||||||
cpu_state.old_fp_control = 0;
|
cpu_state.old_fp_control = 0;
|
||||||
#ifndef _MSC_VER
|
|
||||||
asm(
|
asm(
|
||||||
"fstcw %0\n"
|
"fstcw %0\n"
|
||||||
"stmxcsr %1\n"
|
"stmxcsr %1\n"
|
||||||
: "=m" (cpu_state.old_fp_control2),
|
: "=m" (cpu_state.old_fp_control2),
|
||||||
"=m" (cpu_state.old_fp_control)
|
"=m" (cpu_state.old_fp_control)
|
||||||
);
|
);
|
||||||
#else
|
|
||||||
__asm
|
|
||||||
{
|
|
||||||
fstcw cpu_state.old_fp_control2
|
|
||||||
stmxcsr cpu_state.old_fp_control
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
cpu_state.trunc_fp_control = cpu_state.old_fp_control | 0x6000;
|
cpu_state.trunc_fp_control = cpu_state.old_fp_control | 0x6000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -277,8 +277,8 @@ uint32_t ropFADD ## name(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint
|
|||||||
{ \
|
{ \
|
||||||
x86seg *target_seg; \
|
x86seg *target_seg; \
|
||||||
\
|
\
|
||||||
if ((cpu_state.npxc >> 10) & 3) \
|
if ((cpu_state.npxc >> 10) & 3) \
|
||||||
return 0; \
|
return 0; \
|
||||||
uop_FP_ENTER(ir); \
|
uop_FP_ENTER(ir); \
|
||||||
uop_MOV_IMM(ir, IREG_oldpc, cpu_state.oldpc); \
|
uop_MOV_IMM(ir, IREG_oldpc, cpu_state.oldpc); \
|
||||||
op_pc--; \
|
op_pc--; \
|
||||||
|
|||||||
@@ -52,17 +52,17 @@ int codegen_can_unroll_full(codeblock_t *block, ir_data_t *ir, uint32_t next_pc,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
start = ir->wr_pos;
|
start = ir->wr_pos;
|
||||||
TOP = cpu_state.TOP;
|
TOP = cpu_state.TOP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TOP != cpu_state.TOP)
|
if (TOP != cpu_state.TOP)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
max_unroll = UNROLL_MAX_UOPS / ((ir->wr_pos-start)+6);
|
max_unroll = UNROLL_MAX_UOPS / ((ir->wr_pos-start)+6);
|
||||||
if ((max_version_refcount != 0) && (max_unroll > (UNROLL_MAX_REG_REFERENCES / max_version_refcount)))
|
if (max_unroll > (UNROLL_MAX_REG_REFERENCES / max_version_refcount))
|
||||||
max_unroll = (UNROLL_MAX_REG_REFERENCES / max_version_refcount);
|
max_unroll = (UNROLL_MAX_REG_REFERENCES / max_version_refcount);
|
||||||
if (max_unroll > UNROLL_MAX_COUNT)
|
if (max_unroll > UNROLL_MAX_COUNT)
|
||||||
max_unroll = UNROLL_MAX_COUNT;
|
max_unroll = UNROLL_MAX_COUNT;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
uint32_t ropJMP_r8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
uint32_t ropJMP_r8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||||
{
|
{
|
||||||
int32_t offset = (int32_t)(int8_t)fastreadb(cs + op_pc);
|
uint32_t offset = (int32_t)(int8_t)fastreadb(cs + op_pc);
|
||||||
uint32_t dest_addr = op_pc+1+offset;
|
uint32_t dest_addr = op_pc+1+offset;
|
||||||
|
|
||||||
if (!(op_32 & 0x100))
|
if (!(op_32 & 0x100))
|
||||||
@@ -26,7 +26,7 @@ uint32_t ropJMP_r8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t f
|
|||||||
}
|
}
|
||||||
uint32_t ropJMP_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
uint32_t ropJMP_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||||
{
|
{
|
||||||
int32_t offset = (int32_t)(int16_t)fastreadw(cs + op_pc);
|
uint32_t offset = (int32_t)(int16_t)fastreadw(cs + op_pc);
|
||||||
uint32_t dest_addr = op_pc+2+offset;
|
uint32_t dest_addr = op_pc+2+offset;
|
||||||
|
|
||||||
dest_addr &= 0xffff;
|
dest_addr &= 0xffff;
|
||||||
@@ -38,7 +38,7 @@ uint32_t ropJMP_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t
|
|||||||
}
|
}
|
||||||
uint32_t ropJMP_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
uint32_t ropJMP_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||||
{
|
{
|
||||||
int32_t offset = fastreadl(cs + op_pc);
|
uint32_t offset = fastreadl(cs + op_pc);
|
||||||
uint32_t dest_addr = op_pc+4+offset;
|
uint32_t dest_addr = op_pc+4+offset;
|
||||||
|
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ uint32_t ropAND_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t
|
|||||||
{
|
{
|
||||||
int src_reg = fetchdat & 7;
|
int src_reg = fetchdat & 7;
|
||||||
|
|
||||||
if(src_reg != dest_reg) uop_AND(ir, IREG_8(dest_reg), IREG_8(dest_reg), IREG_8(src_reg));
|
uop_AND(ir, IREG_8(dest_reg), IREG_8(dest_reg), IREG_8(src_reg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -93,7 +93,7 @@ uint32_t ropAND_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_
|
|||||||
{
|
{
|
||||||
int dest_reg = fetchdat & 7;
|
int dest_reg = fetchdat & 7;
|
||||||
|
|
||||||
if(src_reg != dest_reg) uop_AND(ir, IREG_8(dest_reg), IREG_8(dest_reg), IREG_8(src_reg));
|
uop_AND(ir, IREG_8(dest_reg), IREG_8(dest_reg), IREG_8(src_reg));
|
||||||
uop_MOVZX(ir, IREG_flags_res, IREG_8(dest_reg));
|
uop_MOVZX(ir, IREG_flags_res, IREG_8(dest_reg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -124,7 +124,7 @@ uint32_t ropAND_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t
|
|||||||
{
|
{
|
||||||
int src_reg = fetchdat & 7;
|
int src_reg = fetchdat & 7;
|
||||||
|
|
||||||
if(src_reg != dest_reg) uop_AND(ir, IREG_16(dest_reg), IREG_16(dest_reg), IREG_16(src_reg));
|
uop_AND(ir, IREG_16(dest_reg), IREG_16(dest_reg), IREG_16(src_reg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -152,7 +152,7 @@ uint32_t ropAND_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_
|
|||||||
{
|
{
|
||||||
int dest_reg = fetchdat & 7;
|
int dest_reg = fetchdat & 7;
|
||||||
|
|
||||||
if(src_reg != dest_reg) uop_AND(ir, IREG_16(dest_reg), IREG_16(dest_reg), IREG_16(src_reg));
|
uop_AND(ir, IREG_16(dest_reg), IREG_16(dest_reg), IREG_16(src_reg));
|
||||||
uop_MOVZX(ir, IREG_flags_res, IREG_16(dest_reg));
|
uop_MOVZX(ir, IREG_flags_res, IREG_16(dest_reg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -183,7 +183,7 @@ uint32_t ropAND_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t
|
|||||||
{
|
{
|
||||||
int src_reg = fetchdat & 7;
|
int src_reg = fetchdat & 7;
|
||||||
|
|
||||||
if(src_reg != dest_reg) uop_AND(ir, IREG_32(dest_reg), IREG_32(dest_reg), IREG_32(src_reg));
|
uop_AND(ir, IREG_32(dest_reg), IREG_32(dest_reg), IREG_32(src_reg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -211,7 +211,7 @@ uint32_t ropAND_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_
|
|||||||
{
|
{
|
||||||
int dest_reg = fetchdat & 7;
|
int dest_reg = fetchdat & 7;
|
||||||
|
|
||||||
if(src_reg != dest_reg) uop_AND(ir, IREG_32(dest_reg), IREG_32(dest_reg), IREG_32(src_reg));
|
uop_AND(ir, IREG_32(dest_reg), IREG_32(dest_reg), IREG_32(src_reg));
|
||||||
uop_MOV(ir, IREG_flags_res, IREG_32(dest_reg));
|
uop_MOV(ir, IREG_flags_res, IREG_32(dest_reg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -288,7 +288,7 @@ uint32_t ropOR_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t
|
|||||||
{
|
{
|
||||||
int src_reg = fetchdat & 7;
|
int src_reg = fetchdat & 7;
|
||||||
|
|
||||||
if(src_reg != dest_reg) uop_OR(ir, IREG_8(dest_reg), IREG_8(dest_reg), IREG_8(src_reg));
|
uop_OR(ir, IREG_8(dest_reg), IREG_8(dest_reg), IREG_8(src_reg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -316,7 +316,7 @@ uint32_t ropOR_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t
|
|||||||
{
|
{
|
||||||
int dest_reg = fetchdat & 7;
|
int dest_reg = fetchdat & 7;
|
||||||
|
|
||||||
if(src_reg != dest_reg) uop_OR(ir, IREG_8(dest_reg), IREG_8(dest_reg), IREG_8(src_reg));
|
uop_OR(ir, IREG_8(dest_reg), IREG_8(dest_reg), IREG_8(src_reg));
|
||||||
uop_MOVZX(ir, IREG_flags_res, IREG_8(dest_reg));
|
uop_MOVZX(ir, IREG_flags_res, IREG_8(dest_reg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -347,7 +347,7 @@ uint32_t ropOR_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t
|
|||||||
{
|
{
|
||||||
int src_reg = fetchdat & 7;
|
int src_reg = fetchdat & 7;
|
||||||
|
|
||||||
if(src_reg != dest_reg) uop_OR(ir, IREG_16(dest_reg), IREG_16(dest_reg), IREG_16(src_reg));
|
uop_OR(ir, IREG_16(dest_reg), IREG_16(dest_reg), IREG_16(src_reg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -375,7 +375,7 @@ uint32_t ropOR_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t
|
|||||||
{
|
{
|
||||||
int dest_reg = fetchdat & 7;
|
int dest_reg = fetchdat & 7;
|
||||||
|
|
||||||
if(src_reg != dest_reg) uop_OR(ir, IREG_16(dest_reg), IREG_16(dest_reg), IREG_16(src_reg));
|
uop_OR(ir, IREG_16(dest_reg), IREG_16(dest_reg), IREG_16(src_reg));
|
||||||
uop_MOVZX(ir, IREG_flags_res, IREG_16(dest_reg));
|
uop_MOVZX(ir, IREG_flags_res, IREG_16(dest_reg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -406,7 +406,7 @@ uint32_t ropOR_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t
|
|||||||
{
|
{
|
||||||
int src_reg = fetchdat & 7;
|
int src_reg = fetchdat & 7;
|
||||||
|
|
||||||
if(src_reg != dest_reg) uop_OR(ir, IREG_32(dest_reg), IREG_32(dest_reg), IREG_32(src_reg));
|
uop_OR(ir, IREG_32(dest_reg), IREG_32(dest_reg), IREG_32(src_reg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -434,7 +434,7 @@ uint32_t ropOR_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t
|
|||||||
{
|
{
|
||||||
int dest_reg = fetchdat & 7;
|
int dest_reg = fetchdat & 7;
|
||||||
|
|
||||||
if(src_reg != dest_reg) uop_OR(ir, IREG_32(dest_reg), IREG_32(dest_reg), IREG_32(src_reg));
|
uop_OR(ir, IREG_32(dest_reg), IREG_32(dest_reg), IREG_32(src_reg));
|
||||||
uop_MOV(ir, IREG_flags_res, IREG_32(dest_reg));
|
uop_MOV(ir, IREG_flags_res, IREG_32(dest_reg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -278,93 +278,94 @@ static void codegen_reg_load(host_reg_set_t *reg_set, codeblock_t *block, int c,
|
|||||||
{
|
{
|
||||||
case REG_WORD:
|
case REG_WORD:
|
||||||
#ifndef RELEASE_BUILD
|
#ifndef RELEASE_BUILD
|
||||||
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_INTEGER)
|
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_INTEGER)
|
||||||
fatal("codegen_reg_load - REG_WORD !REG_INTEGER\n");
|
fatal("codegen_reg_load - REG_WORD !REG_INTEGER\n");
|
||||||
#endif
|
#endif
|
||||||
if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256)
|
if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256)
|
||||||
codegen_direct_read_16_stack(block, reg_set->reg_list[c].reg, (int)(uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
codegen_direct_read_16_stack(block, reg_set->reg_list[c].reg, (intptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
||||||
else
|
else
|
||||||
codegen_direct_read_16(block, reg_set->reg_list[c].reg, ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
codegen_direct_read_16(block, reg_set->reg_list[c].reg, ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REG_DWORD:
|
case REG_DWORD:
|
||||||
#ifndef RELEASE_BUILD
|
#ifndef RELEASE_BUILD
|
||||||
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_INTEGER)
|
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_INTEGER)
|
||||||
fatal("codegen_reg_load - REG_DWORD !REG_INTEGER\n");
|
fatal("codegen_reg_load - REG_DWORD !REG_INTEGER\n");
|
||||||
#endif
|
#endif
|
||||||
if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256)
|
if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256)
|
||||||
codegen_direct_read_32_stack(block, reg_set->reg_list[c].reg, (int)(uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
codegen_direct_read_32_stack(block, reg_set->reg_list[c].reg, (intptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
||||||
else
|
else
|
||||||
codegen_direct_read_32(block, reg_set->reg_list[c].reg, ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
codegen_direct_read_32(block, reg_set->reg_list[c].reg, ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REG_QWORD:
|
case REG_QWORD:
|
||||||
#ifndef RELEASE_BUILD
|
#ifndef RELEASE_BUILD
|
||||||
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_FP)
|
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_FP)
|
||||||
fatal("codegen_reg_load - REG_QWORD !REG_FP\n");
|
fatal("codegen_reg_load - REG_QWORD !REG_FP\n");
|
||||||
#endif
|
#endif
|
||||||
if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256)
|
if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256)
|
||||||
codegen_direct_read_64_stack(block, reg_set->reg_list[c].reg, (int)(uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
codegen_direct_read_64_stack(block, reg_set->reg_list[c].reg, (intptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
||||||
else
|
else
|
||||||
codegen_direct_read_64(block, reg_set->reg_list[c].reg, ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
codegen_direct_read_64(block, reg_set->reg_list[c].reg, ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REG_POINTER:
|
case REG_POINTER:
|
||||||
#ifndef RELEASE_BUILD
|
#ifndef RELEASE_BUILD
|
||||||
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_INTEGER)
|
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_INTEGER)
|
||||||
fatal("codegen_reg_load - REG_POINTER !REG_INTEGER\n");
|
fatal("codegen_reg_load - REG_POINTER !REG_INTEGER\n");
|
||||||
#endif
|
#endif
|
||||||
if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256)
|
if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256)
|
||||||
codegen_direct_read_pointer_stack(block, reg_set->reg_list[c].reg, (int)(uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
codegen_direct_read_pointer_stack(block, reg_set->reg_list[c].reg, (intptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
||||||
else
|
else
|
||||||
codegen_direct_read_pointer(block, reg_set->reg_list[c].reg, ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
codegen_direct_read_pointer(block, reg_set->reg_list[c].reg, ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REG_DOUBLE:
|
case REG_DOUBLE:
|
||||||
#ifndef RELEASE_BUILD
|
#ifndef RELEASE_BUILD
|
||||||
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_FP)
|
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_FP)
|
||||||
fatal("codegen_reg_load - REG_DOUBLE !REG_FP\n");
|
fatal("codegen_reg_load - REG_DOUBLE !REG_FP\n");
|
||||||
#endif
|
#endif
|
||||||
if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256)
|
if ((uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p < 256)
|
||||||
codegen_direct_read_double_stack(block, reg_set->reg_list[c].reg, (int)(uintptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
codegen_direct_read_double_stack(block, reg_set->reg_list[c].reg, (intptr_t)ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
||||||
else
|
else
|
||||||
codegen_direct_read_double(block, reg_set->reg_list[c].reg, ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
codegen_direct_read_double(block, reg_set->reg_list[c].reg, ireg_data[IREG_GET_REG(ir_reg.reg)].p);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REG_FPU_ST_BYTE:
|
case REG_FPU_ST_BYTE:
|
||||||
#ifndef RELEASE_BUILD
|
#ifndef RELEASE_BUILD
|
||||||
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_INTEGER)
|
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_INTEGER)
|
||||||
fatal("codegen_reg_load - REG_FPU_ST_BYTE !REG_INTEGER\n");
|
fatal("codegen_reg_load - REG_FPU_ST_BYTE !REG_INTEGER\n");
|
||||||
#endif
|
#endif
|
||||||
if (block->flags & CODEBLOCK_STATIC_TOP)
|
if (block->flags & CODEBLOCK_STATIC_TOP)
|
||||||
codegen_direct_read_8(block, reg_set->reg_list[c].reg, &cpu_state.tag[ir_reg.reg & 7]);
|
codegen_direct_read_8(block, reg_set->reg_list[c].reg, &cpu_state.tag[ir_reg.reg & 7]);
|
||||||
else
|
else
|
||||||
codegen_direct_read_st_8(block, reg_set->reg_list[c].reg, &cpu_state.tag[0], ir_reg.reg & 7);
|
codegen_direct_read_st_8(block, reg_set->reg_list[c].reg, &cpu_state.tag[0], ir_reg.reg & 7);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REG_FPU_ST_QWORD:
|
case REG_FPU_ST_QWORD:
|
||||||
#ifndef RELEASE_BUILD
|
#ifndef RELEASE_BUILD
|
||||||
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_FP)
|
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_FP)
|
||||||
fatal("codegen_reg_load - REG_FPU_ST_QWORD !REG_FP\n");
|
fatal("codegen_reg_load - REG_FPU_ST_QWORD !REG_FP\n");
|
||||||
#endif
|
#endif
|
||||||
if (block->flags & CODEBLOCK_STATIC_TOP)
|
if (block->flags & CODEBLOCK_STATIC_TOP)
|
||||||
codegen_direct_read_64(block, reg_set->reg_list[c].reg, &cpu_state.MM[ir_reg.reg & 7]);
|
codegen_direct_read_64(block, reg_set->reg_list[c].reg, &cpu_state.MM[ir_reg.reg & 7]);
|
||||||
else
|
else
|
||||||
codegen_direct_read_st_64(block, reg_set->reg_list[c].reg, &cpu_state.MM[0], ir_reg.reg & 7);
|
codegen_direct_read_st_64(block, reg_set->reg_list[c].reg, &cpu_state.MM[0], ir_reg.reg & 7);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REG_FPU_ST_DOUBLE:
|
case REG_FPU_ST_DOUBLE:
|
||||||
#ifndef RELEASE_BUILD
|
#ifndef RELEASE_BUILD
|
||||||
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_FP)
|
if (ireg_data[IREG_GET_REG(ir_reg.reg)].type != REG_FP)
|
||||||
fatal("codegen_reg_load - REG_FPU_ST_DOUBLE !REG_FP\n");
|
fatal("codegen_reg_load - REG_FPU_ST_DOUBLE !REG_FP\n");
|
||||||
#endif
|
#endif
|
||||||
if (block->flags & CODEBLOCK_STATIC_TOP)
|
if (block->flags & CODEBLOCK_STATIC_TOP)
|
||||||
codegen_direct_read_double(block, reg_set->reg_list[c].reg, &cpu_state.ST[ir_reg.reg & 7]);
|
codegen_direct_read_double(block, reg_set->reg_list[c].reg, &cpu_state.ST[ir_reg.reg & 7]);
|
||||||
else
|
else
|
||||||
codegen_direct_read_st_double(block, reg_set->reg_list[c].reg, &cpu_state.ST[0], ir_reg.reg & 7);
|
codegen_direct_read_st_double(block, reg_set->reg_list[c].reg, &cpu_state.ST[0], ir_reg.reg & 7);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: fatal("codegen_reg_load - native_size=%i reg=%i\n", ireg_data[IREG_GET_REG(ir_reg.reg)].native_size, IREG_GET_REG(ir_reg.reg));
|
default:
|
||||||
|
fatal("codegen_reg_load - native_size=%i reg=%i\n", ireg_data[IREG_GET_REG(ir_reg.reg)].native_size, IREG_GET_REG(ir_reg.reg));
|
||||||
}
|
}
|
||||||
|
|
||||||
reg_set->regs[c] = ir_reg;
|
reg_set->regs[c] = ir_reg;
|
||||||
@@ -407,7 +408,7 @@ static void codegen_reg_writeback(host_reg_set_t *reg_set, codeblock_t *block, i
|
|||||||
fatal("codegen_reg_writeback - REG_DWORD !REG_INTEGER\n");
|
fatal("codegen_reg_writeback - REG_DWORD !REG_INTEGER\n");
|
||||||
#endif
|
#endif
|
||||||
if ((uintptr_t)p < 256)
|
if ((uintptr_t)p < 256)
|
||||||
codegen_direct_write_32_stack(block, (int)(uintptr_t)p, reg_set->reg_list[c].reg);
|
codegen_direct_write_32_stack(block, (intptr_t)p, reg_set->reg_list[c].reg);
|
||||||
else
|
else
|
||||||
codegen_direct_write_32(block, p, reg_set->reg_list[c].reg);
|
codegen_direct_write_32(block, p, reg_set->reg_list[c].reg);
|
||||||
break;
|
break;
|
||||||
@@ -418,7 +419,7 @@ static void codegen_reg_writeback(host_reg_set_t *reg_set, codeblock_t *block, i
|
|||||||
fatal("codegen_reg_writeback - REG_QWORD !REG_FP\n");
|
fatal("codegen_reg_writeback - REG_QWORD !REG_FP\n");
|
||||||
#endif
|
#endif
|
||||||
if ((uintptr_t)p < 256)
|
if ((uintptr_t)p < 256)
|
||||||
codegen_direct_write_64_stack(block, (int)(uintptr_t)p, reg_set->reg_list[c].reg);
|
codegen_direct_write_64_stack(block, (intptr_t)p, reg_set->reg_list[c].reg);
|
||||||
else
|
else
|
||||||
codegen_direct_write_64(block, p, reg_set->reg_list[c].reg);
|
codegen_direct_write_64(block, p, reg_set->reg_list[c].reg);
|
||||||
break;
|
break;
|
||||||
@@ -439,7 +440,7 @@ static void codegen_reg_writeback(host_reg_set_t *reg_set, codeblock_t *block, i
|
|||||||
fatal("codegen_reg_writeback - REG_DOUBLE !REG_FP\n");
|
fatal("codegen_reg_writeback - REG_DOUBLE !REG_FP\n");
|
||||||
#endif
|
#endif
|
||||||
if ((uintptr_t)p < 256)
|
if ((uintptr_t)p < 256)
|
||||||
codegen_direct_write_double_stack(block, (int)(uintptr_t)p, reg_set->reg_list[c].reg);
|
codegen_direct_write_double_stack(block, (intptr_t)p, reg_set->reg_list[c].reg);
|
||||||
else
|
else
|
||||||
codegen_direct_write_double(block, p, reg_set->reg_list[c].reg);
|
codegen_direct_write_double(block, p, reg_set->reg_list[c].reg);
|
||||||
break;
|
break;
|
||||||
@@ -512,7 +513,7 @@ void codegen_reg_write_imm(codeblock_t *block, ir_reg_t ir_reg, uint32_t imm_dat
|
|||||||
|
|
||||||
case REG_DWORD:
|
case REG_DWORD:
|
||||||
if ((uintptr_t)p < 256)
|
if ((uintptr_t)p < 256)
|
||||||
codegen_direct_write_32_imm_stack(block, (int)(intptr_t)p, imm_data);
|
codegen_direct_write_32_imm_stack(block, (int)p, imm_data);
|
||||||
else
|
else
|
||||||
codegen_direct_write_32_imm(block, p, imm_data);
|
codegen_direct_write_32_imm(block, p, imm_data);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -339,10 +339,11 @@ static inline ir_reg_t codegen_reg_read(int reg)
|
|||||||
fatal("codegen_reg_read - refcount overflow\n");
|
fatal("codegen_reg_read - refcount overflow\n");
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (version->refcount > REG_REFCOUNT_MAX)
|
if (version->refcount > REG_REFCOUNT_MAX)
|
||||||
CPU_BLOCK_END();
|
CPU_BLOCK_END();
|
||||||
if (version->refcount > max_version_refcount)
|
if (version->refcount > max_version_refcount)
|
||||||
max_version_refcount = version->refcount;
|
max_version_refcount = version->refcount;
|
||||||
|
// pclog("codegen_reg_read: %i %i %i\n", reg & IREG_REG_MASK, ireg.version, reg_version_refcount[IREG_GET_REG(ireg.reg)][ireg.version]);
|
||||||
return ireg;
|
return ireg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +375,7 @@ static inline ir_reg_t codegen_reg_write(int reg, int uop_nr)
|
|||||||
fatal("codegen_reg_write - version overflow\n");
|
fatal("codegen_reg_write - version overflow\n");
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (reg_last_version[IREG_GET_REG(reg)] > REG_VERSION_MAX)
|
if (reg_last_version[IREG_GET_REG(reg)] > REG_VERSION_MAX)
|
||||||
CPU_BLOCK_END();
|
CPU_BLOCK_END();
|
||||||
if (reg_last_version[IREG_GET_REG(reg)] > max_version_refcount)
|
if (reg_last_version[IREG_GET_REG(reg)] > max_version_refcount)
|
||||||
max_version_refcount = reg_last_version[IREG_GET_REG(reg)];
|
max_version_refcount = reg_last_version[IREG_GET_REG(reg)];
|
||||||
@@ -383,6 +384,7 @@ static inline ir_reg_t codegen_reg_write(int reg, int uop_nr)
|
|||||||
version->refcount = 0;
|
version->refcount = 0;
|
||||||
version->flags = 0;
|
version->flags = 0;
|
||||||
version->parent_uop = uop_nr;
|
version->parent_uop = uop_nr;
|
||||||
|
// pclog("codegen_reg_write: %i\n", reg & IREG_REG_MASK);
|
||||||
return ireg;
|
return ireg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,9 +65,8 @@ uint32_t old_rammask = 0xffffffff;
|
|||||||
|
|
||||||
int soft_reset_mask = 0;
|
int soft_reset_mask = 0;
|
||||||
|
|
||||||
int in_smm = 0, smi_line = 0, smi_latched = 0, smm_in_hlt = 0;
|
int smi_latched = 0;
|
||||||
int smi_block = 0;
|
int smm_in_hlt = 0, smi_block = 0;
|
||||||
uint32_t smbase = 0x30000;
|
|
||||||
|
|
||||||
uint32_t addr64, addr64_2;
|
uint32_t addr64, addr64_2;
|
||||||
uint32_t addr64a[8], addr64a_2[8];
|
uint32_t addr64a[8], addr64a_2[8];
|
||||||
@@ -1845,7 +1844,6 @@ sysret(uint32_t fetchdat)
|
|||||||
/* This is for compatibility with new x87 code. */
|
/* This is for compatibility with new x87 code. */
|
||||||
void codegen_set_rounding_mode(int mode)
|
void codegen_set_rounding_mode(int mode)
|
||||||
{
|
{
|
||||||
/* cpu_state.new_npxc = (cpu_state.old_npxc & ~0xc00) | (cpu_state.npxc & 0xc00); */
|
/* cpu_state.new_npxc = (cpu_state.old_npxc & ~0xc00) | (mode << 10); */
|
||||||
cpu_state.new_npxc = (cpu_state.old_npxc & ~0xc00) | (mode << 10);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -391,10 +391,10 @@ exec386_dynarec_dyn(void)
|
|||||||
codeblock_t *block = codeblock_hash[hash];
|
codeblock_t *block = codeblock_hash[hash];
|
||||||
#endif
|
#endif
|
||||||
int valid_block = 0;
|
int valid_block = 0;
|
||||||
|
|
||||||
#ifdef USE_NEW_DYNAREC
|
#ifdef USE_NEW_DYNAREC
|
||||||
if (!cpu_state.abrt)
|
if (!cpu_state.abrt)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
if (block && !cpu_state.abrt)
|
if (block && !cpu_state.abrt)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -535,6 +535,9 @@ exec386_dynarec_dyn(void)
|
|||||||
cpu_block_end = 0;
|
cpu_block_end = 0;
|
||||||
x86_was_reset = 0;
|
x86_was_reset = 0;
|
||||||
|
|
||||||
|
#if defined(__APPLE__) && defined(__aarch64__)
|
||||||
|
pthread_jit_write_protect_np(0);
|
||||||
|
#endif
|
||||||
codegen_block_start_recompile(block);
|
codegen_block_start_recompile(block);
|
||||||
codegen_in_recompile = 1;
|
codegen_in_recompile = 1;
|
||||||
|
|
||||||
@@ -585,21 +588,21 @@ exec386_dynarec_dyn(void)
|
|||||||
#endif
|
#endif
|
||||||
CPU_BLOCK_END();
|
CPU_BLOCK_END();
|
||||||
|
|
||||||
|
if (cpu_state.flags & T_FLAG)
|
||||||
|
CPU_BLOCK_END();
|
||||||
|
if (smi_line)
|
||||||
|
CPU_BLOCK_END();
|
||||||
|
if (nmi && nmi_enable && nmi_mask)
|
||||||
|
CPU_BLOCK_END();
|
||||||
|
if ((cpu_state.flags & I_FLAG) && pic.int_pending && !cpu_end_block_after_ins)
|
||||||
|
CPU_BLOCK_END();
|
||||||
|
|
||||||
if (cpu_end_block_after_ins) {
|
if (cpu_end_block_after_ins) {
|
||||||
cpu_end_block_after_ins--;
|
cpu_end_block_after_ins--;
|
||||||
if (!cpu_end_block_after_ins)
|
if (!cpu_end_block_after_ins)
|
||||||
CPU_BLOCK_END();
|
CPU_BLOCK_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smi_line)
|
|
||||||
CPU_BLOCK_END();
|
|
||||||
else if (cpu_state.flags & T_FLAG)
|
|
||||||
CPU_BLOCK_END();
|
|
||||||
else if (nmi && nmi_enable && nmi_mask)
|
|
||||||
CPU_BLOCK_END();
|
|
||||||
else if ((cpu_state.flags & I_FLAG) && pic.int_pending && !cpu_end_block_after_ins)
|
|
||||||
CPU_BLOCK_END();
|
|
||||||
|
|
||||||
if (cpu_state.abrt) {
|
if (cpu_state.abrt) {
|
||||||
if (!(cpu_state.abrt & ABRT_EXPECTED))
|
if (!(cpu_state.abrt & ABRT_EXPECTED))
|
||||||
codegen_block_remove();
|
codegen_block_remove();
|
||||||
@@ -616,6 +619,9 @@ exec386_dynarec_dyn(void)
|
|||||||
codegen_reset();
|
codegen_reset();
|
||||||
|
|
||||||
codegen_in_recompile = 0;
|
codegen_in_recompile = 0;
|
||||||
|
#if defined(__APPLE__) && defined(__aarch64__)
|
||||||
|
pthread_jit_write_protect_np(1);
|
||||||
|
#endif
|
||||||
} else if (!cpu_state.abrt) {
|
} else if (!cpu_state.abrt) {
|
||||||
/* Mark block but do not recompile */
|
/* Mark block but do not recompile */
|
||||||
#ifdef USE_NEW_DYNAREC
|
#ifdef USE_NEW_DYNAREC
|
||||||
@@ -642,8 +648,8 @@ exec386_dynarec_dyn(void)
|
|||||||
cpu_state.ssegs = 0;
|
cpu_state.ssegs = 0;
|
||||||
|
|
||||||
codegen_endpc = (cs + cpu_state.pc) + 8;
|
codegen_endpc = (cs + cpu_state.pc) + 8;
|
||||||
|
|
||||||
fetchdat = fastreadl(cs + cpu_state.pc);
|
fetchdat = fastreadl(cs + cpu_state.pc);
|
||||||
|
|
||||||
#ifdef ENABLE_386_DYNAREC_LOG
|
#ifdef ENABLE_386_DYNAREC_LOG
|
||||||
if (in_smm)
|
if (in_smm)
|
||||||
x386_dynarec_log("[%04X:%08X] fetchdat = %08X\n", CS, cpu_state.pc, fetchdat);
|
x386_dynarec_log("[%04X:%08X] fetchdat = %08X\n", CS, cpu_state.pc, fetchdat);
|
||||||
@@ -677,13 +683,13 @@ exec386_dynarec_dyn(void)
|
|||||||
#endif
|
#endif
|
||||||
CPU_BLOCK_END();
|
CPU_BLOCK_END();
|
||||||
|
|
||||||
|
if (cpu_state.flags & T_FLAG)
|
||||||
|
CPU_BLOCK_END();
|
||||||
if (smi_line)
|
if (smi_line)
|
||||||
CPU_BLOCK_END();
|
CPU_BLOCK_END();
|
||||||
else if (cpu_state.flags & T_FLAG)
|
if (nmi && nmi_enable && nmi_mask)
|
||||||
CPU_BLOCK_END();
|
CPU_BLOCK_END();
|
||||||
else if (nmi && nmi_enable && nmi_mask)
|
if ((cpu_state.flags & I_FLAG) && pic.int_pending && !cpu_end_block_after_ins)
|
||||||
CPU_BLOCK_END();
|
|
||||||
else if ((cpu_state.flags & I_FLAG) && pic.int_pending && !cpu_end_block_after_ins)
|
|
||||||
CPU_BLOCK_END();
|
CPU_BLOCK_END();
|
||||||
|
|
||||||
if (cpu_end_block_after_ins) {
|
if (cpu_end_block_after_ins) {
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ enum {
|
|||||||
#define CPUID_3DNOW (1UL << 31UL)
|
#define CPUID_3DNOW (1UL << 31UL)
|
||||||
|
|
||||||
|
|
||||||
|
/* Make sure this is as low as possible. */
|
||||||
|
cpu_state_t cpu_state;
|
||||||
|
|
||||||
#ifdef USE_DYNAREC
|
#ifdef USE_DYNAREC
|
||||||
const OpFn *x86_dynarec_opcodes, *x86_dynarec_opcodes_0f,
|
const OpFn *x86_dynarec_opcodes, *x86_dynarec_opcodes_0f,
|
||||||
*x86_dynarec_opcodes_d8_a16, *x86_dynarec_opcodes_d8_a32,
|
*x86_dynarec_opcodes_d8_a16, *x86_dynarec_opcodes_d8_a32,
|
||||||
@@ -128,8 +131,6 @@ double cpu_dmulti;
|
|||||||
|
|
||||||
msr_t msr;
|
msr_t msr;
|
||||||
|
|
||||||
cpu_state_t cpu_state;
|
|
||||||
|
|
||||||
cyrix_t cyrix;
|
cyrix_t cyrix;
|
||||||
|
|
||||||
cpu_family_t *cpu_f;
|
cpu_family_t *cpu_f;
|
||||||
|
|||||||
@@ -210,11 +210,12 @@ typedef union {
|
|||||||
} x86reg;
|
} x86reg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
uint32_t base;
|
||||||
|
uint32_t limit;
|
||||||
uint8_t access, ar_high;
|
uint8_t access, ar_high;
|
||||||
int8_t checked; /*Non-zero if selector is known to be valid*/
|
|
||||||
uint16_t seg;
|
uint16_t seg;
|
||||||
uint32_t base, limit,
|
uint32_t limit_low, limit_high;
|
||||||
limit_low, limit_high;
|
int checked; /*Non-zero if selector is known to be valid*/
|
||||||
} x86seg;
|
} x86seg;
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
@@ -352,9 +353,9 @@ typedef struct {
|
|||||||
} rm_data;
|
} rm_data;
|
||||||
|
|
||||||
uint8_t ssegs, ismmx,
|
uint8_t ssegs, ismmx,
|
||||||
abrt, pad;
|
abrt, _smi_line;
|
||||||
|
|
||||||
int _cycles;
|
int _cycles, _in_smm;
|
||||||
|
|
||||||
uint16_t npxs, npxc;
|
uint16_t npxs, npxc;
|
||||||
|
|
||||||
@@ -364,8 +365,6 @@ typedef struct {
|
|||||||
|
|
||||||
MMX_REG MM[8];
|
MMX_REG MM[8];
|
||||||
|
|
||||||
uint16_t old_npxc, new_npxc;
|
|
||||||
|
|
||||||
#ifdef USE_NEW_DYNAREC
|
#ifdef USE_NEW_DYNAREC
|
||||||
uint32_t old_fp_control, new_fp_control;
|
uint32_t old_fp_control, new_fp_control;
|
||||||
#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
|
#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
|
||||||
@@ -374,6 +373,8 @@ typedef struct {
|
|||||||
#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86 || defined __amd64__ || defined _M_X64
|
#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86 || defined __amd64__ || defined _M_X64
|
||||||
uint32_t trunc_fp_control;
|
uint32_t trunc_fp_control;
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
uint16_t old_npxc, new_npxc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
x86seg seg_cs, seg_ds, seg_es, seg_ss,
|
x86seg seg_cs, seg_ds, seg_es, seg_ss,
|
||||||
@@ -385,8 +386,17 @@ typedef struct {
|
|||||||
} CR0;
|
} CR0;
|
||||||
|
|
||||||
uint16_t flags, eflags;
|
uint16_t flags, eflags;
|
||||||
|
|
||||||
|
uint32_t _smbase;
|
||||||
} cpu_state_t;
|
} cpu_state_t;
|
||||||
|
|
||||||
|
|
||||||
|
#define in_smm cpu_state._in_smm
|
||||||
|
#define smi_line cpu_state._smi_line
|
||||||
|
|
||||||
|
#define smbase cpu_state._smbase
|
||||||
|
|
||||||
|
|
||||||
/*The cpu_state.flags below must match in both cpu_cur_status and block->status for a block
|
/*The cpu_state.flags below must match in both cpu_cur_status and block->status for a block
|
||||||
to be valid*/
|
to be valid*/
|
||||||
#define CPU_STATUS_USE32 (1 << 0)
|
#define CPU_STATUS_USE32 (1 << 0)
|
||||||
@@ -461,6 +471,8 @@ COMPILE_TIME_ASSERT(sizeof(cpu_state_t) <= 128)
|
|||||||
|
|
||||||
|
|
||||||
/* Global variables. */
|
/* Global variables. */
|
||||||
|
extern cpu_state_t cpu_state;
|
||||||
|
|
||||||
extern const cpu_family_t cpu_families[];
|
extern const cpu_family_t cpu_families[];
|
||||||
extern const cpu_legacy_machine_t cpu_legacy_table[];
|
extern const cpu_legacy_machine_t cpu_legacy_table[];
|
||||||
extern cpu_family_t *cpu_f;
|
extern cpu_family_t *cpu_f;
|
||||||
@@ -493,9 +505,8 @@ extern int hasfpu;
|
|||||||
|
|
||||||
extern uint32_t cpu_features;
|
extern uint32_t cpu_features;
|
||||||
|
|
||||||
extern int in_smm, smi_line, smi_latched, smm_in_hlt;
|
extern int smi_latched, smm_in_hlt;
|
||||||
extern int smi_block;
|
extern int smi_block;
|
||||||
extern uint32_t smbase;
|
|
||||||
|
|
||||||
#ifdef USE_NEW_DYNAREC
|
#ifdef USE_NEW_DYNAREC
|
||||||
extern uint16_t cpu_cur_status;
|
extern uint16_t cpu_cur_status;
|
||||||
@@ -505,7 +516,6 @@ extern uint32_t cpu_cur_status;
|
|||||||
extern uint64_t cpu_CR4_mask;
|
extern uint64_t cpu_CR4_mask;
|
||||||
extern uint64_t tsc;
|
extern uint64_t tsc;
|
||||||
extern msr_t msr;
|
extern msr_t msr;
|
||||||
extern cpu_state_t cpu_state;
|
|
||||||
extern uint8_t opcode;
|
extern uint8_t opcode;
|
||||||
extern int cgate16;
|
extern int cgate16;
|
||||||
extern int cpl_override;
|
extern int cpl_override;
|
||||||
|
|||||||
@@ -244,10 +244,15 @@ mem_flush_write_page(uint32_t addr, uint32_t virt)
|
|||||||
{
|
{
|
||||||
page_t *page_target = &pages[addr >> 12];
|
page_t *page_target = &pages[addr >> 12];
|
||||||
int c;
|
int c;
|
||||||
|
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||||
uint32_t a;
|
uint32_t a;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (c = 0; c < 256; c++) {
|
for (c = 0; c < 256; c++) {
|
||||||
if (writelookup[c] != (int) 0xffffffff) {
|
if (writelookup[c] != (int) 0xffffffff) {
|
||||||
|
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||||
|
uintptr_t target = (uintptr_t)&ram[(uintptr_t)(addr & ~0xfff) - (virt & ~0xfff)];
|
||||||
|
#else
|
||||||
a = (uintptr_t)(addr & ~0xfff) - (virt & ~0xfff);
|
a = (uintptr_t)(addr & ~0xfff) - (virt & ~0xfff);
|
||||||
uintptr_t target;
|
uintptr_t target;
|
||||||
|
|
||||||
@@ -255,6 +260,7 @@ mem_flush_write_page(uint32_t addr, uint32_t virt)
|
|||||||
target = (uintptr_t)&ram2[a - (1 << 30)];
|
target = (uintptr_t)&ram2[a - (1 << 30)];
|
||||||
else
|
else
|
||||||
target = (uintptr_t)&ram[a];
|
target = (uintptr_t)&ram[a];
|
||||||
|
#endif
|
||||||
|
|
||||||
if (writelookup2[writelookup[c]] == target || page_lookup[writelookup[c]] == page_target) {
|
if (writelookup2[writelookup[c]] == target || page_lookup[writelookup[c]] == page_target) {
|
||||||
writelookup2[writelookup[c]] = LOOKUP_INV;
|
writelookup2[writelookup[c]] = LOOKUP_INV;
|
||||||
@@ -556,9 +562,7 @@ mem_addr_translate(uint32_t addr, uint32_t chunk_start, uint32_t len)
|
|||||||
void
|
void
|
||||||
addreadlookup(uint32_t virt, uint32_t phys)
|
addreadlookup(uint32_t virt, uint32_t phys)
|
||||||
{
|
{
|
||||||
#if (defined __amd64__ || defined _M_X64)
|
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||||
uint64_t a;
|
|
||||||
#else
|
|
||||||
uint32_t a;
|
uint32_t a;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -572,16 +576,16 @@ addreadlookup(uint32_t virt, uint32_t phys)
|
|||||||
readlookup2[readlookup[readlnext]] = LOOKUP_INV;
|
readlookup2[readlookup[readlnext]] = LOOKUP_INV;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined __amd64__ || defined _M_X64)
|
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||||
a = ((uint64_t)(phys & ~0xfff) - (uint64_t)(virt & ~0xfff));
|
readlookup2[virt>>12] = (uintptr_t)&ram[(uintptr_t)(phys & ~0xFFF) - (uintptr_t)(virt & ~0xfff)];
|
||||||
#else
|
#else
|
||||||
a = ((uint32_t)(phys & ~0xfff) - (uint32_t)(virt & ~0xfff));
|
a = ((uint32_t)(phys & ~0xfff) - (uint32_t)(virt & ~0xfff));
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((phys & ~0xfff) >= (1 << 30))
|
if ((phys & ~0xfff) >= (1 << 30))
|
||||||
readlookup2[virt>>12] = (uintptr_t)&ram2[a - (1 << 30)];
|
readlookup2[virt>>12] = (uintptr_t)&ram2[a - (1 << 30)];
|
||||||
else
|
else
|
||||||
readlookup2[virt>>12] = (uintptr_t)&ram[a];
|
readlookup2[virt>>12] = (uintptr_t)&ram[a];
|
||||||
|
#endif
|
||||||
readlookupp[virt>>12] = mmu_perm;
|
readlookupp[virt>>12] = mmu_perm;
|
||||||
|
|
||||||
readlookup[readlnext++] = virt >> 12;
|
readlookup[readlnext++] = virt >> 12;
|
||||||
@@ -594,9 +598,7 @@ addreadlookup(uint32_t virt, uint32_t phys)
|
|||||||
void
|
void
|
||||||
addwritelookup(uint32_t virt, uint32_t phys)
|
addwritelookup(uint32_t virt, uint32_t phys)
|
||||||
{
|
{
|
||||||
#if (defined __amd64__ || defined _M_X64)
|
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||||
uint64_t a;
|
|
||||||
#else
|
|
||||||
uint32_t a;
|
uint32_t a;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -625,16 +627,16 @@ addwritelookup(uint32_t virt, uint32_t phys)
|
|||||||
page_lookup[virt >> 12] = &pages[phys >> 12];
|
page_lookup[virt >> 12] = &pages[phys >> 12];
|
||||||
page_lookupp[virt >> 12] = mmu_perm;
|
page_lookupp[virt >> 12] = mmu_perm;
|
||||||
} else {
|
} else {
|
||||||
#if (defined __amd64__ || defined _M_X64)
|
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||||
a = ((uint64_t)(phys & ~0xfff) - (uint64_t)(virt & ~0xfff));
|
writelookup2[virt>>12] = (uintptr_t)&ram[(uintptr_t)(phys & ~0xFFF) - (uintptr_t)(virt & ~0xfff)];
|
||||||
#else
|
#else
|
||||||
a = ((uint32_t)(phys & ~0xfff) - (uint32_t)(virt & ~0xfff));
|
a = ((uint32_t)(phys & ~0xfff) - (uint32_t)(virt & ~0xfff));
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((phys & ~0xfff) >= (1 << 30))
|
if ((phys & ~0xfff) >= (1 << 30))
|
||||||
writelookup2[virt>>12] = (uintptr_t)&ram2[a - (1 << 30)];
|
writelookup2[virt>>12] = (uintptr_t)&ram2[a - (1 << 30)];
|
||||||
else
|
else
|
||||||
writelookup2[virt>>12] = (uintptr_t)&ram[a];
|
writelookup2[virt>>12] = (uintptr_t)&ram[a];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
writelookupp[virt>>12] = mmu_perm;
|
writelookupp[virt>>12] = mmu_perm;
|
||||||
|
|
||||||
@@ -2616,7 +2618,7 @@ mem_reset(void)
|
|||||||
free(ram);
|
free(ram);
|
||||||
ram = NULL;
|
ram = NULL;
|
||||||
}
|
}
|
||||||
#if (!(defined __amd64__ || defined _M_X64))
|
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||||
if (ram2 != NULL) {
|
if (ram2 != NULL) {
|
||||||
free(ram2);
|
free(ram2);
|
||||||
ram2 = NULL;
|
ram2 = NULL;
|
||||||
@@ -2628,7 +2630,7 @@ mem_reset(void)
|
|||||||
|
|
||||||
m = 1024UL * mem_size;
|
m = 1024UL * mem_size;
|
||||||
|
|
||||||
#if (!(defined __amd64__ || defined _M_X64))
|
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||||
if (mem_size > 1048576) {
|
if (mem_size > 1048576) {
|
||||||
ram = (uint8_t *)malloc(1 << 30); /* allocate and clear the RAM block of the first 1 GB */
|
ram = (uint8_t *)malloc(1 << 30); /* allocate and clear the RAM block of the first 1 GB */
|
||||||
if (ram == NULL) {
|
if (ram == NULL) {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ typedef struct
|
|||||||
uint8_t cursor64_data[1024];
|
uint8_t cursor64_data[1024];
|
||||||
uint8_t palettes[3][256];
|
uint8_t palettes[3][256];
|
||||||
ibm_rgb528_pixel32_t extra_pal[4];
|
ibm_rgb528_pixel32_t extra_pal[4];
|
||||||
int hwc_y, hwc_x;
|
int16_t hwc_y, hwc_x;
|
||||||
uint16_t index, smlc_part;
|
uint16_t index, smlc_part;
|
||||||
uint8_t cmd_r0;
|
uint8_t cmd_r0;
|
||||||
uint8_t cmd_r1;
|
uint8_t cmd_r1;
|
||||||
@@ -68,7 +68,8 @@ typedef struct
|
|||||||
uint8_t cmd_r3;
|
uint8_t cmd_r3;
|
||||||
uint8_t cmd_r4;
|
uint8_t cmd_r4;
|
||||||
uint8_t status, indx_cntl;
|
uint8_t status, indx_cntl;
|
||||||
uint8_t cursor_array;
|
uint8_t cursor_array,
|
||||||
|
cursor_hotspot_x, cursor_hotspot_y;
|
||||||
} ibm_rgb528_ramdac_t;
|
} ibm_rgb528_ramdac_t;
|
||||||
|
|
||||||
|
|
||||||
@@ -641,7 +642,8 @@ ibm_rgb528_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga
|
|||||||
case 0x031:
|
case 0x031:
|
||||||
if (!updt_cntl)
|
if (!updt_cntl)
|
||||||
break;
|
break;
|
||||||
svga->dac_hwcursor.x = (svga->dac_hwcursor.x & 0xff00) | val;
|
ramdac->hwc_x = (ramdac->hwc_x & 0xff00) | val;
|
||||||
|
svga->dac_hwcursor.x = ((int) ramdac->hwc_x) - ramdac->cursor_hotspot_x;
|
||||||
break;
|
break;
|
||||||
case 0x032:
|
case 0x032:
|
||||||
/* Sign-extend the sign bit (7) to the remaining bits (6-4). */
|
/* Sign-extend the sign bit (7) to the remaining bits (6-4). */
|
||||||
@@ -651,12 +653,14 @@ ibm_rgb528_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga
|
|||||||
ramdac->indexed_data[ramdac->index] = val;
|
ramdac->indexed_data[ramdac->index] = val;
|
||||||
if (!updt_cntl)
|
if (!updt_cntl)
|
||||||
break;
|
break;
|
||||||
svga->dac_hwcursor.x = (svga->dac_hwcursor.x & 0x00ff) | (val << 8);
|
ramdac->hwc_x = (ramdac->hwc_x & 0x00ff) | (val << 8);
|
||||||
|
svga->dac_hwcursor.x = ((int) ramdac->hwc_x) - ramdac->cursor_hotspot_x;
|
||||||
break;
|
break;
|
||||||
case 0x033:
|
case 0x033:
|
||||||
if (!updt_cntl)
|
if (!updt_cntl)
|
||||||
break;
|
break;
|
||||||
svga->dac_hwcursor.y = (svga->dac_hwcursor.y & 0xff00) | val;
|
ramdac->hwc_y = (ramdac->hwc_y & 0xff00) | val;
|
||||||
|
svga->dac_hwcursor.y = ((int) ramdac->hwc_y) - ramdac->cursor_hotspot_y;
|
||||||
break;
|
break;
|
||||||
case 0x034:
|
case 0x034:
|
||||||
/* Sign-extend the sign bit (7) to the remaining bits (6-4). */
|
/* Sign-extend the sign bit (7) to the remaining bits (6-4). */
|
||||||
@@ -664,26 +668,31 @@ ibm_rgb528_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga
|
|||||||
if (val & 0x80)
|
if (val & 0x80)
|
||||||
val |= 0x70;
|
val |= 0x70;
|
||||||
ramdac->indexed_data[ramdac->index] = val;
|
ramdac->indexed_data[ramdac->index] = val;
|
||||||
if (updt_cntl)
|
if (updt_cntl) {
|
||||||
svga->dac_hwcursor.y = (svga->dac_hwcursor.y & 0x00ff) | (val << 8);
|
ramdac->hwc_y = (ramdac->hwc_y & 0x00ff) | (val << 8);
|
||||||
else {
|
svga->dac_hwcursor.y = ((int) ramdac->hwc_y) - ramdac->cursor_hotspot_y;
|
||||||
svga->dac_hwcursor.x = ramdac->indexed_data[0x031];
|
} else {
|
||||||
svga->dac_hwcursor.x |= (ramdac->indexed_data[0x032] << 8);
|
ramdac->hwc_x = ramdac->indexed_data[0x031];
|
||||||
svga->dac_hwcursor.y = ramdac->indexed_data[0x033];
|
ramdac->hwc_x |= (ramdac->indexed_data[0x032] << 8);
|
||||||
svga->dac_hwcursor.y |= (val << 8);
|
ramdac->hwc_y = ramdac->indexed_data[0x033];
|
||||||
|
ramdac->hwc_y |= (val << 8);
|
||||||
|
svga->dac_hwcursor.x = ((int) ramdac->hwc_x) - ramdac->cursor_hotspot_x;
|
||||||
|
svga->dac_hwcursor.y = ((int) ramdac->hwc_y) - ramdac->cursor_hotspot_y;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x035:
|
case 0x035:
|
||||||
if (svga->dac_hwcursor.xsize == 64)
|
if (svga->dac_hwcursor.xsize == 64)
|
||||||
svga->dac_hwcursor.xoff = (val & 0x1f);
|
ramdac->cursor_hotspot_x = (val & 0x3f);
|
||||||
else
|
else
|
||||||
svga->dac_hwcursor.xoff = (val & 0x3f);
|
ramdac->cursor_hotspot_x = (val & 0x1f);
|
||||||
|
svga->dac_hwcursor.x = ((int) ramdac->hwc_x) - ramdac->cursor_hotspot_x;
|
||||||
break;
|
break;
|
||||||
case 0x036:
|
case 0x036:
|
||||||
if (svga->dac_hwcursor.xsize == 64)
|
if (svga->dac_hwcursor.xsize == 64)
|
||||||
svga->dac_hwcursor.yoff = (val & 0x1f);
|
ramdac->cursor_hotspot_y = (val & 0x3f);
|
||||||
else
|
else
|
||||||
svga->dac_hwcursor.yoff = (val & 0x3f);
|
ramdac->cursor_hotspot_y = (val & 0x1f);
|
||||||
|
svga->dac_hwcursor.y = ((int) ramdac->hwc_y) - ramdac->cursor_hotspot_y;
|
||||||
break;
|
break;
|
||||||
case 0x040: case 0x043: case 0x046:
|
case 0x040: case 0x043: case 0x046:
|
||||||
ramdac->extra_pal[(ramdac->index - 0x40) / 3].r = val;
|
ramdac->extra_pal[(ramdac->index - 0x40) / 3].r = val;
|
||||||
@@ -762,19 +771,19 @@ ibm_rgb528_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga)
|
|||||||
break;
|
break;
|
||||||
case 0x0031:
|
case 0x0031:
|
||||||
if (loc_read)
|
if (loc_read)
|
||||||
temp = svga->dac_hwcursor.x & 0xff;
|
temp = ramdac->hwc_x & 0xff;
|
||||||
break;
|
break;
|
||||||
case 0x0032:
|
case 0x0032:
|
||||||
if (loc_read)
|
if (loc_read)
|
||||||
temp = svga->dac_hwcursor.x >> 8;
|
temp = ramdac->hwc_x >> 8;
|
||||||
break;
|
break;
|
||||||
case 0x0033:
|
case 0x0033:
|
||||||
if (loc_read)
|
if (loc_read)
|
||||||
temp = svga->dac_hwcursor.y & 0xff;
|
temp = ramdac->hwc_y & 0xff;
|
||||||
break;
|
break;
|
||||||
case 0x0034:
|
case 0x0034:
|
||||||
if (loc_read)
|
if (loc_read)
|
||||||
temp = svga->dac_hwcursor.y >> 8;
|
temp = ramdac->hwc_y >> 8;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
temp = ramdac->indexed_data[ramdac->index];
|
temp = ramdac->indexed_data[ramdac->index];
|
||||||
@@ -852,7 +861,7 @@ ibm_rgb528_hwcursor_draw(svga_t *svga, int displine)
|
|||||||
x_pos = offset + svga->x_add;
|
x_pos = offset + svga->x_add;
|
||||||
p = buffer32->line[y_pos];
|
p = buffer32->line[y_pos];
|
||||||
|
|
||||||
for (x = 0; x < svga->dac_hwcursor_latch.xsize; x ++) {
|
for (x = 0; x < svga->dac_hwcursor_latch.xsize; x++) {
|
||||||
if (!(x & 3))
|
if (!(x & 3))
|
||||||
four_pixels = ramdac->indexed_data[svga->dac_hwcursor_latch.addr];
|
four_pixels = ramdac->indexed_data[svga->dac_hwcursor_latch.addr];
|
||||||
|
|
||||||
|
|||||||
@@ -434,34 +434,34 @@ void blit_thread(void *param)
|
|||||||
while (thread_run) {
|
while (thread_run) {
|
||||||
thread_wait_event(blit_data.wake_blit_thread, -1);
|
thread_wait_event(blit_data.wake_blit_thread, -1);
|
||||||
thread_reset_event(blit_data.wake_blit_thread);
|
thread_reset_event(blit_data.wake_blit_thread);
|
||||||
MTR_BEGIN("video", "blit_thread");
|
MTR_BEGIN("video", "blit_thread");
|
||||||
|
|
||||||
if (blit_data.y2 > 0) {
|
if (blit_data.y2 > 0) {
|
||||||
for (yy = blit_data.y1; yy < blit_data.y2; yy++) {
|
for (yy = blit_data.y1; yy < blit_data.y2; yy++) {
|
||||||
if (((blit_data.y + yy) >= 0) && ((blit_data.y + yy) < buffer32->h)) {
|
if (((blit_data.y + yy) >= 0) && ((blit_data.y + yy) < buffer32->h)) {
|
||||||
if (video_grayscale || invert_display)
|
if (video_grayscale || invert_display)
|
||||||
video_transform_copy(&(render_buffer->dat)[yy * blit_data.w], &(buffer32->line[blit_data.y + yy][blit_data.x]), blit_data.w);
|
video_transform_copy(&(render_buffer->dat)[yy * blit_data.w], &(buffer32->line[blit_data.y + yy][blit_data.x]), blit_data.w);
|
||||||
else
|
else
|
||||||
memcpy(&(render_buffer->dat)[yy * blit_data.w], &(buffer32->line[blit_data.y + yy][blit_data.x]), blit_data.w << 2);
|
memcpy(&(render_buffer->dat)[yy * blit_data.w], &(buffer32->line[blit_data.y + yy][blit_data.x]), blit_data.w << 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (screenshots) {
|
if (screenshots) {
|
||||||
if (render_buffer != NULL)
|
if (render_buffer != NULL)
|
||||||
video_screenshot(blit_data.x, blit_data.y, blit_data.y1, blit_data.y2, blit_data.w, blit_data.h);
|
video_screenshot(blit_data.x, blit_data.y, blit_data.y1, blit_data.y2, blit_data.w, blit_data.h);
|
||||||
screenshots--;
|
screenshots--;
|
||||||
video_log("screenshot taken, %i left\n", screenshots);
|
video_log("screenshot taken, %i left\n", screenshots);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blit_func)
|
if (blit_func)
|
||||||
blit_func(blit_data.x, blit_data.y,
|
blit_func(blit_data.x, blit_data.y,
|
||||||
blit_data.y1, blit_data.y2,
|
blit_data.y1, blit_data.y2,
|
||||||
blit_data.w, blit_data.h);
|
blit_data.w, blit_data.h);
|
||||||
|
|
||||||
blit_data.busy = 0;
|
blit_data.busy = 0;
|
||||||
|
|
||||||
MTR_END("video", "blit_thread");
|
MTR_END("video", "blit_thread");
|
||||||
thread_set_event(blit_data.blit_complete);
|
thread_set_event(blit_data.blit_complete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -583,10 +583,11 @@ MAINOBJ := 86box.o config.o log.o random.o timer.o io.o acpi.o apm.o dma.o ddma
|
|||||||
|
|
||||||
MEMOBJ := catalyst_flash.o i2c_eeprom.o intel_flash.o mem.o rom.o smram.o spd.o sst_flash.o
|
MEMOBJ := catalyst_flash.o i2c_eeprom.o intel_flash.o mem.o rom.o smram.o spd.o sst_flash.o
|
||||||
|
|
||||||
CPUOBJ := cpu.o cpu_table.o fpu.o x86.o \
|
CPUOBJ := $(DYNARECOBJ) \
|
||||||
808x.o 386.o 386_common.o 386_dynarec.o 386_dynarec_ops.o $(CGTOBJ) \
|
$(CGTOBJ) \
|
||||||
x86seg.o x87.o x87_timings.o \
|
cpu.o cpu_table.o fpu.o x86.o \
|
||||||
$(DYNARECOBJ)
|
808x.o 386.o 386_common.o 386_dynarec.o 386_dynarec_ops.o \
|
||||||
|
x86seg.o x87.o x87_timings.o
|
||||||
|
|
||||||
CHIPSETOBJ := acc2168.o \
|
CHIPSETOBJ := acc2168.o \
|
||||||
contaq_82c59x.o \
|
contaq_82c59x.o \
|
||||||
@@ -810,8 +811,13 @@ LIBS += $(WX_LIBS) -lm
|
|||||||
endif
|
endif
|
||||||
LIBS += -lpng -lz -lwsock32 -lshell32 -liphlpapi -lpsapi -lSDL2 -limm32 -lhid -lsetupapi -loleaut32 -luxtheme -lversion -lwinmm -static -lstdc++
|
LIBS += -lpng -lz -lwsock32 -lshell32 -liphlpapi -lpsapi -lSDL2 -limm32 -lhid -lsetupapi -loleaut32 -luxtheme -lversion -lwinmm -static -lstdc++
|
||||||
ifneq ($(X64), y)
|
ifneq ($(X64), y)
|
||||||
|
ifneq ($(ARM64), y)
|
||||||
LIBS += -Wl,--large-address-aware
|
LIBS += -Wl,--large-address-aware
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(ARM64), y)
|
||||||
|
LIBS += -lgcc
|
||||||
|
endif
|
||||||
ifeq ($(DINPUT), y)
|
ifeq ($(DINPUT), y)
|
||||||
LIBS += -ldinput8
|
LIBS += -ldinput8
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user