Fixed a number of bugs in the NCR 53C810 code;
64-bit Windows 86Box now compiles without warnings.
This commit is contained in:
@@ -146,7 +146,7 @@ static uint32_t ropFSTs(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint3
|
||||
static uint32_t ropFSTd(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
int host_reg1, host_reg2;
|
||||
int host_reg1 = 0, host_reg2 = 0;
|
||||
|
||||
FP_ENTER();
|
||||
op_pc--;
|
||||
@@ -556,7 +556,7 @@ static uint32_t ropFISTPl(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uin
|
||||
static uint32_t ropFISTPq(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
int host_reg1, host_reg2;
|
||||
int host_reg1 = 0, host_reg2 = 0;
|
||||
|
||||
FP_ENTER();
|
||||
op_pc--;
|
||||
@@ -622,11 +622,9 @@ static uint32_t ropFCHS(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint3
|
||||
static uint32_t ropFLD ## name(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
static double fp_imm = v; \
|
||||
static uint64_t *fpp; \
|
||||
\
|
||||
FP_ENTER(); \
|
||||
fpp = (uint64_t *)&fp_imm; \
|
||||
FP_LOAD_IMM_Q(*fpp); \
|
||||
FP_LOAD_IMM_Q(*(uint64_t *)&fp_imm); \
|
||||
\
|
||||
return op_pc; \
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
static uint32_t ropMOVQ_q_mm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
{
|
||||
int host_reg1, host_reg2;
|
||||
int host_reg1 = 0, host_reg2 = 0;
|
||||
|
||||
MMX_ENTER();
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
#ifdef __amd64__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../86box.h"
|
||||
#include "../mem.h"
|
||||
#include "cpu.h"
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86_ops.h"
|
||||
#include "x87.h"
|
||||
#include "../mem.h"
|
||||
|
||||
#include "386_common.h"
|
||||
|
||||
#include "codegen.h"
|
||||
#include "codegen_ops.h"
|
||||
#include "codegen_ops_x86-64.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
int codegen_flat_ds, codegen_flat_ss;
|
||||
int codegen_flags_changed = 0;
|
||||
int codegen_fpu_entered = 0;
|
||||
@@ -64,7 +63,9 @@ static int last_ssegs;
|
||||
|
||||
void codegen_init()
|
||||
{
|
||||
#ifdef __linux__
|
||||
int c;
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
void *start;
|
||||
size_t len;
|
||||
long pagesize = sysconf(_SC_PAGESIZE);
|
||||
@@ -81,7 +82,10 @@ void codegen_init()
|
||||
memset(codeblock, 0, BLOCK_SIZE * sizeof(codeblock_t));
|
||||
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
|
||||
|
||||
#ifdef __linux__
|
||||
for (c = 0; c < BLOCK_SIZE; c++)
|
||||
codeblock[c].valid = 0;
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
start = (void *)((long)codeblock & pagemask);
|
||||
len = ((BLOCK_SIZE * sizeof(codeblock_t)) + pagesize) & pagemask;
|
||||
if (mprotect(start, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
|
||||
@@ -90,17 +94,37 @@ void codegen_init()
|
||||
exit(-1);
|
||||
}
|
||||
#endif
|
||||
// pclog("Codegen is %p\n", (void *)pages[0xfab12 >> 12].block);
|
||||
}
|
||||
|
||||
void codegen_reset()
|
||||
{
|
||||
int c;
|
||||
|
||||
memset(codeblock, 0, BLOCK_SIZE * sizeof(codeblock_t));
|
||||
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
|
||||
mem_reset_page_blocks();
|
||||
|
||||
for (c = 0; c < BLOCK_SIZE; c++)
|
||||
codeblock[c].valid = 0;
|
||||
}
|
||||
|
||||
void dump_block()
|
||||
{
|
||||
/* codeblock_t *block = pages[0x119000 >> 12].block;
|
||||
|
||||
pclog("dump_block:\n");
|
||||
while (block)
|
||||
{
|
||||
uint32_t start_pc = (block->pc & 0xffc) | (block->phys & ~0xfff);
|
||||
uint32_t end_pc = (block->endpc & 0xffc) | (block->phys & ~0xfff);
|
||||
pclog(" %p : %08x-%08x %08x-%08x %p %p\n", (void *)block, start_pc, end_pc, block->pc, block->endpc, (void *)block->prev, (void *)block->next);
|
||||
if (!block->pc)
|
||||
fatal("Dead PC=0\n");
|
||||
|
||||
block = block->next;
|
||||
}
|
||||
pclog("dump_block done\n");*/
|
||||
}
|
||||
|
||||
static void add_to_block_list(codeblock_t *block)
|
||||
@@ -124,7 +148,7 @@ static void add_to_block_list(codeblock_t *block)
|
||||
|
||||
if (block->next)
|
||||
{
|
||||
if (!block->next->valid)
|
||||
if (block->next->valid == 0)
|
||||
fatal("block->next->valid=0 %p %p %x %x\n", (void *)block->next, (void *)codeblock, block_current, block_pos);
|
||||
}
|
||||
|
||||
@@ -141,7 +165,7 @@ static void add_to_block_list(codeblock_t *block)
|
||||
else
|
||||
{
|
||||
block->next_2 = NULL;
|
||||
pages[block->phys_2 >> 12].block_2[(block->phys_2 >> 10) & 3] = block;
|
||||
pages[block->phys_2 >> 12].block_2[(block->phys_2 >> 10) & 3] = block;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,6 +204,7 @@ static void remove_from_block_list(codeblock_t *block, uint32_t pc)
|
||||
}
|
||||
else
|
||||
{
|
||||
// pclog(" pages.block_2=%p 3 %p %p\n", (void *)block->next_2, (void *)block, (void *)pages[block->phys_2 >> 12].block_2);
|
||||
pages[block->phys_2 >> 12].block_2[(block->phys_2 >> 10) & 3] = block->next_2;
|
||||
if (block->next_2)
|
||||
block->next_2->prev_2 = NULL;
|
||||
@@ -195,7 +220,7 @@ static void delete_block(codeblock_t *block)
|
||||
if (block == codeblock_hash[HASH(block->phys)])
|
||||
codeblock_hash[HASH(block->phys)] = NULL;
|
||||
|
||||
if (!block->valid)
|
||||
if (block->valid == 0)
|
||||
fatal("Deleting deleted block\n");
|
||||
block->valid = 0;
|
||||
|
||||
@@ -237,9 +262,6 @@ void codegen_check_flush(page_t *page, uint64_t mask, uint32_t phys_addr)
|
||||
void codegen_block_init(uint32_t phys_addr)
|
||||
{
|
||||
codeblock_t *block;
|
||||
#if UNUSED
|
||||
int has_evicted = 0;
|
||||
#endif
|
||||
page_t *page = &pages[phys_addr >> 12];
|
||||
|
||||
if (!page->block[(phys_addr >> 10) & 3])
|
||||
@@ -248,8 +270,11 @@ void codegen_block_init(uint32_t phys_addr)
|
||||
block_current = (block_current + 1) & BLOCK_MASK;
|
||||
block = &codeblock[block_current];
|
||||
|
||||
// if (block->pc == 0xb00b4ff5)
|
||||
// pclog("Init target block\n");
|
||||
if (block->valid != 0)
|
||||
{
|
||||
// pclog("Reuse block : was %08x now %08x\n", block->pc, cs+pc);
|
||||
delete_block(block);
|
||||
cpu_recomp_reuse++;
|
||||
}
|
||||
@@ -268,8 +293,7 @@ void codegen_block_init(uint32_t phys_addr)
|
||||
block->next_2 = block->prev_2 = NULL;
|
||||
block->page_mask = 0;
|
||||
block->flags = 0;
|
||||
|
||||
block->status = cpu_cur_status;
|
||||
block->status = cpu_cur_status;
|
||||
|
||||
block->was_recompiled = 0;
|
||||
|
||||
@@ -280,9 +304,6 @@ void codegen_block_init(uint32_t phys_addr)
|
||||
|
||||
void codegen_block_start_recompile(codeblock_t *block)
|
||||
{
|
||||
#if UNUSED
|
||||
int has_evicted = 0;
|
||||
#endif
|
||||
page_t *page = &pages[block->phys >> 12];
|
||||
|
||||
if (!page->block[(block->phys >> 10) & 3])
|
||||
@@ -353,6 +374,8 @@ void codegen_block_start_recompile(codeblock_t *block)
|
||||
addbyte(0xBD);
|
||||
addquad(((uintptr_t)&cpu_state) + 128);
|
||||
|
||||
// pclog("New block %i for %08X %03x\n", block_current, cs+pc, block_num);
|
||||
|
||||
last_op32 = -1;
|
||||
last_ea_seg = NULL;
|
||||
last_ssegs = -1;
|
||||
@@ -412,9 +435,11 @@ void codegen_block_generate_end_mask()
|
||||
start_pc >>= PAGE_MASK_SHIFT;
|
||||
end_pc >>= PAGE_MASK_SHIFT;
|
||||
|
||||
// pclog("block_end: %08x %08x\n", start_pc, end_pc);
|
||||
for (; start_pc <= end_pc; start_pc++)
|
||||
{
|
||||
block->page_mask |= ((uint64_t)1 << start_pc);
|
||||
// pclog(" %08x %llx\n", start_pc, block->page_mask);
|
||||
}
|
||||
|
||||
pages[block->phys >> 12].code_present_mask[(block->phys >> 10) & 3] |= block->page_mask;
|
||||
@@ -427,7 +452,7 @@ void codegen_block_generate_end_mask()
|
||||
block->phys_2 = get_phys_noabrt(block->endpc);
|
||||
if (block->phys_2 != -1)
|
||||
{
|
||||
page_t *page_2 = &pages[block->phys_2 >> 12];
|
||||
page_t *page_2 = &pages[block->phys_2 >> 12];
|
||||
|
||||
start_pc = 0;
|
||||
end_pc = (block->endpc & 0x3ff) >> PAGE_MASK_SHIFT;
|
||||
@@ -442,14 +467,16 @@ void codegen_block_generate_end_mask()
|
||||
fatal("!page_mask2\n");
|
||||
if (block->next_2)
|
||||
{
|
||||
if (!block->next_2->valid)
|
||||
fatal("block->next_2->vsalid=0 %p\n", (void *)block->next_2);
|
||||
// pclog(" next_2->pc=%08x\n", block->next_2->pc);
|
||||
if (block->next_2->valid == 0)
|
||||
fatal("block->next_2->valid=0 %p\n", (void *)block->next_2);
|
||||
}
|
||||
|
||||
block->dirty_mask2 = &page_2->dirty_mask[(block->phys_2 >> PAGE_MASK_INDEX_SHIFT) & PAGE_MASK_INDEX_MASK];
|
||||
}
|
||||
}
|
||||
|
||||
// pclog("block_end: %08x %08x %016llx\n", block->pc, block->endpc, block->page_mask);
|
||||
recomp_page = -1;
|
||||
}
|
||||
|
||||
@@ -469,16 +496,26 @@ void codegen_block_end_recompile(codeblock_t *block)
|
||||
{
|
||||
addbyte(0x81); /*SUB $codegen_block_cycles, cyclcs*/
|
||||
addbyte(0x6d);
|
||||
addbyte(cpu_state_offset(_cycles));
|
||||
addbyte((uint8_t)cpu_state_offset(_cycles));
|
||||
addlong((uint32_t)codegen_block_cycles);
|
||||
}
|
||||
if (codegen_block_ins)
|
||||
{
|
||||
addbyte(0x81); /*ADD $codegen_block_ins,ins*/
|
||||
addbyte(0x45);
|
||||
addbyte(cpu_state_offset(cpu_recomp_ins));
|
||||
addbyte((uint8_t)cpu_state_offset(cpu_recomp_ins));
|
||||
addlong(codegen_block_ins);
|
||||
}
|
||||
#if 0
|
||||
if (codegen_block_full_ins)
|
||||
{
|
||||
addbyte(0x81); /*ADD $codegen_block_ins,ins*/
|
||||
addbyte(0x04);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)&cpu_recomp_full_ins);
|
||||
addlong(codegen_block_full_ins);
|
||||
}
|
||||
#endif
|
||||
addbyte(0x48); /*ADDL $40,%rsp*/
|
||||
addbyte(0x83);
|
||||
addbyte(0xC4);
|
||||
@@ -505,6 +542,7 @@ void codegen_block_end_recompile(codeblock_t *block)
|
||||
block->next_2 = block->prev_2 = NULL;
|
||||
codegen_block_generate_end_mask();
|
||||
add_to_block_list(block);
|
||||
// pclog("End block %i\n", block_num);
|
||||
}
|
||||
|
||||
void codegen_flush()
|
||||
@@ -512,29 +550,6 @@ void codegen_flush()
|
||||
return;
|
||||
}
|
||||
|
||||
static int opcode_conditional_jump[256] =
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /*00*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*10*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*20*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*30*/
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*40*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*60*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*70*/
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*80*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*90*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*a0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*b0*/
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*d0*/
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*e0*/
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*f0*/
|
||||
};
|
||||
|
||||
static int opcode_modrm[256] =
|
||||
{
|
||||
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*00*/
|
||||
@@ -571,7 +586,7 @@ int opcode_0f_modrm[256] =
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*80*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*90*/
|
||||
0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, /*a0*/
|
||||
0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, /*a0*/
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, /*b0*/
|
||||
|
||||
1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
||||
@@ -594,7 +609,7 @@ static x86seg *codegen_generate_ea_16_long(x86seg *op_ea_seg, uint32_t fetchdat,
|
||||
{
|
||||
addbyte(0xC7); /*MOVL $0,(ssegs)*/
|
||||
addbyte(0x45);
|
||||
addbyte(cpu_state_offset(eaaddr));
|
||||
addbyte((uint8_t)cpu_state_offset(eaaddr));
|
||||
addlong((fetchdat >> 8) & 0xffff);
|
||||
(*op_pc) += 2;
|
||||
}
|
||||
@@ -704,14 +719,14 @@ static x86seg *codegen_generate_ea_16_long(x86seg *op_ea_seg, uint32_t fetchdat,
|
||||
}
|
||||
addbyte(0x89); /*MOV eaaddr, EAX*/
|
||||
addbyte(0x45);
|
||||
addbyte(cpu_state_offset(eaaddr));
|
||||
addbyte((uint8_t)cpu_state_offset(eaaddr));
|
||||
|
||||
if (mod1seg[cpu_rm] == &ss && !op_ssegs)
|
||||
op_ea_seg = &_ss;
|
||||
}
|
||||
return op_ea_seg;
|
||||
}
|
||||
|
||||
//#if 0
|
||||
static x86seg *codegen_generate_ea_32_long(x86seg *op_ea_seg, uint32_t fetchdat, int op_ssegs, uint32_t *op_pc, int stack_offset)
|
||||
{
|
||||
uint32_t new_eaaddr;
|
||||
@@ -859,7 +874,7 @@ static x86seg *codegen_generate_ea_32_long(x86seg *op_ea_seg, uint32_t fetchdat,
|
||||
|
||||
addbyte(0x89); /*MOV eaaddr, EAX*/
|
||||
addbyte(0x45);
|
||||
addbyte(cpu_state_offset(eaaddr));
|
||||
addbyte((uint8_t)cpu_state_offset(eaaddr));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -870,7 +885,7 @@ static x86seg *codegen_generate_ea_32_long(x86seg *op_ea_seg, uint32_t fetchdat,
|
||||
new_eaaddr = fastreadl(cs + (*op_pc) + 1);
|
||||
addbyte(0xC7); /*MOVL $new_eaaddr,(eaaddr)*/
|
||||
addbyte(0x45);
|
||||
addbyte(cpu_state_offset(eaaddr));
|
||||
addbyte((uint8_t)cpu_state_offset(eaaddr));
|
||||
addlong(new_eaaddr);
|
||||
(*op_pc) += 4;
|
||||
return op_ea_seg;
|
||||
@@ -901,19 +916,19 @@ static x86seg *codegen_generate_ea_32_long(x86seg *op_ea_seg, uint32_t fetchdat,
|
||||
}
|
||||
addbyte(0x89); /*MOV eaaddr, EAX*/
|
||||
addbyte(0x45);
|
||||
addbyte(cpu_state_offset(eaaddr));
|
||||
addbyte((uint8_t)cpu_state_offset(eaaddr));
|
||||
}
|
||||
else
|
||||
{
|
||||
addbyte(0x44); /*MOV eaaddr, base_reg*/
|
||||
addbyte(0x89);
|
||||
addbyte(0x45 | (base_reg << 3));
|
||||
addbyte(cpu_state_offset(eaaddr));
|
||||
addbyte((uint8_t)cpu_state_offset(eaaddr));
|
||||
}
|
||||
}
|
||||
return op_ea_seg;
|
||||
}
|
||||
|
||||
//#endif
|
||||
void codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_pc, uint32_t old_pc)
|
||||
{
|
||||
codeblock_t *block = &codeblock[block_current];
|
||||
@@ -1084,18 +1099,18 @@ void codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t
|
||||
generate_call:
|
||||
codegen_timing_opcode(opcode, fetchdat, op_32);
|
||||
|
||||
if (((op_table == x86_dynarec_opcodes) &&
|
||||
(((opcode & 0xf0) == 0x70) || ((opcode & 0xfc) == 0xe0) || (opcode == 0xc2) ||
|
||||
((opcode & 0xfe) == 0xca) || ((opcode & 0xfc) == 0xcc) || ((opcode & 0xfc) == 0xe8) ||
|
||||
((opcode == 0xff) && (((fetchdat & 0x38) >= 0x10) && ((fetchdat & 0x38) < 0x30)))) ||
|
||||
((op_table == x86_dynarec_opcodes_0f) && ((opcode & 0xf0) == 0x80))))
|
||||
if ((op_table == x86_dynarec_opcodes &&
|
||||
((opcode & 0xf0) == 0x70 || (opcode & 0xfc) == 0xe0 || opcode == 0xc2 ||
|
||||
(opcode & 0xfe) == 0xca || (opcode & 0xfc) == 0xcc || (opcode & 0xfc) == 0xe8 ||
|
||||
(opcode == 0xff && ((fetchdat & 0x38) >= 0x10 && (fetchdat & 0x38) < 0x30)))) ||
|
||||
(op_table == x86_dynarec_opcodes_0f && ((opcode & 0xf0) == 0x80)))
|
||||
{
|
||||
/*Opcode is likely to cause block to exit, update cycle count*/
|
||||
if (codegen_block_cycles)
|
||||
{
|
||||
addbyte(0x81); /*SUB $codegen_block_cycles, cyclcs*/
|
||||
addbyte(0x6d);
|
||||
addbyte(cpu_state_offset(_cycles));
|
||||
addbyte((uint8_t)cpu_state_offset(_cycles));
|
||||
addlong((uint32_t)codegen_block_cycles);
|
||||
codegen_block_cycles = 0;
|
||||
}
|
||||
@@ -1103,10 +1118,21 @@ generate_call:
|
||||
{
|
||||
addbyte(0x81); /*ADD $codegen_block_ins,ins*/
|
||||
addbyte(0x45);
|
||||
addbyte(cpu_state_offset(cpu_recomp_ins));
|
||||
addbyte((uint8_t)cpu_state_offset(cpu_recomp_ins));
|
||||
addlong(codegen_block_ins);
|
||||
codegen_block_ins = 0;
|
||||
}
|
||||
#if 0
|
||||
if (codegen_block_full_ins)
|
||||
{
|
||||
addbyte(0x81); /*ADD $codegen_block_ins,ins*/
|
||||
addbyte(0x04);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)&cpu_recomp_full_ins);
|
||||
addlong(codegen_block_full_ins);
|
||||
codegen_block_full_ins = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((op_table == x86_dynarec_opcodes_REPNE || op_table == x86_dynarec_opcodes_REPE) && !op_table[opcode | op_32])
|
||||
@@ -1133,15 +1159,17 @@ generate_call:
|
||||
}
|
||||
|
||||
op = op_table[((opcode >> opcode_shift) | op_32) & opcode_mask];
|
||||
// if (output)
|
||||
// pclog("Generate call at %08X %02X %08X %02X %08X %08X %08X %08X %08X %02X %02X %02X %02X\n", &codeblock[block_current][block_pos], opcode, new_pc, ram[old_pc], EAX, EBX, ECX, EDX, ESI, ram[0x7bd2+6],ram[0x7bd2+7],ram[0x7bd2+8],ram[0x7bd2+9]);
|
||||
if (op_ssegs != last_ssegs)
|
||||
{
|
||||
last_ssegs = op_ssegs;
|
||||
addbyte(0xC6); /*MOVB $0,(ssegs)*/
|
||||
addbyte(0x45);
|
||||
addbyte(cpu_state_offset(ssegs));
|
||||
addbyte((uint8_t)cpu_state_offset(ssegs));
|
||||
addbyte(op_ssegs);
|
||||
}
|
||||
|
||||
//#if 0
|
||||
if ((!test_modrm ||
|
||||
(op_table == x86_dynarec_opcodes && opcode_modrm[opcode]) ||
|
||||
(op_table == x86_dynarec_opcodes_0f && opcode_0f_modrm[opcode]))/* && !(op_32 & 0x200)*/)
|
||||
@@ -1157,7 +1185,7 @@ generate_call:
|
||||
|
||||
addbyte(0xC7); /*MOVL $rm | mod | reg,(rm_mod_reg_data)*/
|
||||
addbyte(0x45);
|
||||
addbyte(cpu_state_offset(rm_data.rm_mod_reg_data));
|
||||
addbyte((uint8_t)cpu_state_offset(rm_data.rm_mod_reg_data));
|
||||
addlong(cpu_rm | (cpu_mod << 8) | (cpu_reg << 16));
|
||||
|
||||
op_pc += pc_off;
|
||||
@@ -1167,30 +1195,31 @@ generate_call:
|
||||
op_ea_seg = codegen_generate_ea_32_long(op_ea_seg, fetchdat, op_ssegs, &op_pc, stack_offset);
|
||||
op_pc -= pc_off;
|
||||
}
|
||||
|
||||
//#endif
|
||||
if (op_ea_seg != last_ea_seg)
|
||||
{
|
||||
// last_ea_seg = op_ea_seg;
|
||||
addbyte(0xC7); /*MOVL $&_ds,(ea_seg)*/
|
||||
addbyte(0x45);
|
||||
addbyte(cpu_state_offset(ea_seg));
|
||||
addlong((uint32_t)op_ea_seg);
|
||||
addbyte((uint8_t)cpu_state_offset(ea_seg));
|
||||
addlong((uint32_t)(uintptr_t)op_ea_seg);
|
||||
}
|
||||
|
||||
|
||||
addbyte(0xC7); /*MOVL [pc],new_pc*/
|
||||
addbyte(0x45);
|
||||
addbyte(cpu_state_offset(pc));
|
||||
addbyte((uint8_t)cpu_state_offset(pc));
|
||||
addlong(op_pc + pc_off);
|
||||
addbyte(0xC7); /*MOVL $old_pc,(oldpc)*/
|
||||
addbyte(0x45);
|
||||
addbyte(cpu_state_offset(oldpc));
|
||||
addbyte((uint8_t)cpu_state_offset(oldpc));
|
||||
addlong(old_pc);
|
||||
if (op_32 != last_op32)
|
||||
{
|
||||
last_op32 = op_32;
|
||||
addbyte(0xC7); /*MOVL $use32,(op32)*/
|
||||
addbyte(0x45);
|
||||
addbyte(cpu_state_offset(op32));
|
||||
addbyte((uint8_t)cpu_state_offset(op32));
|
||||
addlong(op_32);
|
||||
}
|
||||
|
||||
@@ -1204,7 +1233,9 @@ generate_call:
|
||||
addbyte(0x85); /*OR %eax, %eax*/
|
||||
addbyte(0xc0);
|
||||
addbyte(0x0F); addbyte(0x85); /*JNZ 0*/
|
||||
addlong((uint32_t)&block->data[BLOCK_EXIT_OFFSET] - (uint32_t)(&block->data[block_pos + 4]));
|
||||
addlong((uint32_t)(uintptr_t)&block->data[BLOCK_EXIT_OFFSET] - (uint32_t)(uintptr_t)(&block->data[block_pos + 4]));
|
||||
|
||||
// call(block, codegen_debug);
|
||||
|
||||
codegen_endpc = (cs + cpu_state.pc) + 8;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ int cksum(struct SLIRPmbuf *m, int len)
|
||||
/*
|
||||
* Force to even boundary.
|
||||
*/
|
||||
if ((1 & (long) w) && (mlen > 0)) {
|
||||
if ((1 & (intptr_t) w) && (mlen > 0)) {
|
||||
REDUCE;
|
||||
sum <<= 8;
|
||||
s_util.c[0] = *(u_int8_t *)w;
|
||||
|
||||
@@ -209,6 +209,10 @@ typedef u_int32_t caddr32_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __amd64__
|
||||
typedef uintptr_t ipqp_32;
|
||||
typedef uintptr_t ipasfragp_32;
|
||||
#else
|
||||
#if SIZEOF_CHAR_P == 4
|
||||
typedef struct ipq *ipqp_32;
|
||||
typedef struct ipasfrag *ipasfragp_32;
|
||||
@@ -216,6 +220,7 @@ typedef struct ipasfrag *ipasfragp_32;
|
||||
typedef caddr32_t ipqp_32;
|
||||
typedef caddr32_t ipasfragp_32;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Overlay for ip header used by other protocols (tcp, udp).
|
||||
@@ -225,7 +230,11 @@ typedef caddr32_t ipasfragp_32;
|
||||
#endif
|
||||
|
||||
struct ipovly {
|
||||
#ifdef __amd64__
|
||||
uintptr_t ih_next, ih_prev; /* for protocol sequence q's */
|
||||
#else
|
||||
caddr32_t ih_next, ih_prev; /* for protocol sequence q's */
|
||||
#endif
|
||||
u_int8_t ih_x1; /* (unused) */
|
||||
u_int8_t ih_pr; /* protocol */
|
||||
u_int16_t ih_len; /* protocol length */
|
||||
@@ -249,7 +258,11 @@ struct ipovly {
|
||||
* size 28 bytes
|
||||
*/
|
||||
struct ipq {
|
||||
#ifdef __amd64__
|
||||
uintptr_t next,prev; /* to other reass headers */
|
||||
#else
|
||||
ipqp_32 next,prev; /* to other reass headers */
|
||||
#endif
|
||||
u_int8_t ipq_ttl; /* time for reass q to live */
|
||||
u_int8_t ipq_p; /* protocol of this fragment */
|
||||
u_int16_t ipq_id; /* sequence id for reassembly */
|
||||
|
||||
@@ -129,8 +129,8 @@ getouraddr()
|
||||
//what?!
|
||||
|
||||
struct quehead_32 {
|
||||
u_int32_t qh_link;
|
||||
u_int32_t qh_rlink;
|
||||
uintptr_t qh_link;
|
||||
uintptr_t qh_rlink;
|
||||
};
|
||||
|
||||
inline void
|
||||
@@ -141,10 +141,10 @@ insque_32(a, b)
|
||||
register struct quehead_32 *element = (struct quehead_32 *) a;
|
||||
register struct quehead_32 *head = (struct quehead_32 *) b;
|
||||
element->qh_link = head->qh_link;
|
||||
head->qh_link = (u_int32_t)element;
|
||||
element->qh_rlink = (u_int32_t)head;
|
||||
head->qh_link = (uintptr_t)element;
|
||||
element->qh_rlink = (uintptr_t)head;
|
||||
((struct quehead_32 *)(element->qh_link))->qh_rlink
|
||||
= (u_int32_t)element;
|
||||
= (uintptr_t)element;
|
||||
}
|
||||
|
||||
inline void
|
||||
|
||||
@@ -46,12 +46,24 @@ typedef unsigned long ioctlsockopt_t;
|
||||
# include <iphlpapi.h>
|
||||
|
||||
# define USE_FIONBIO 1
|
||||
#ifndef EWOULDBLOCK
|
||||
# define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#endif
|
||||
#ifndef EINPROGRESS
|
||||
# define EINPROGRESS WSAEINPROGRESS
|
||||
#endif
|
||||
#ifndef ENOTCONN
|
||||
# define ENOTCONN WSAENOTCONN
|
||||
#endif
|
||||
#ifndef EHOSTUNREACH
|
||||
# define EHOSTUNREACH WSAEHOSTUNREACH
|
||||
#endif
|
||||
#ifndef ENETUNREACH
|
||||
# define ENETUNREACH WSAENETUNREACH
|
||||
#endif
|
||||
#ifndef ECONNREFUSED
|
||||
# define ECONNREFUSED WSAECONNREFUSED
|
||||
#endif
|
||||
|
||||
/* Basilisk II Router defines those */
|
||||
# define udp_read_completion slirp_udp_read_completion
|
||||
|
||||
@@ -33,7 +33,11 @@
|
||||
#ifndef _TCP_H_
|
||||
#define _TCP_H_
|
||||
|
||||
#ifdef __amd64__
|
||||
typedef uintptr_t tcp_seq;
|
||||
#else
|
||||
typedef u_int32_t tcp_seq;
|
||||
#endif
|
||||
|
||||
#define PR_SLOWHZ 2 /* 2 slow timeouts per second (approx) */
|
||||
#define PR_FASTHZ 5 /* 5 fast timeouts per second (not important) */
|
||||
|
||||
@@ -36,11 +36,15 @@
|
||||
#include "tcpip.h"
|
||||
#include "tcp_timer.h"
|
||||
|
||||
#ifdef __amd64__
|
||||
typedef uintptr_t tcpiphdrp_32;
|
||||
#else
|
||||
#if SIZEOF_CHAR_P == 4
|
||||
typedef struct tcpiphdr *tcpiphdrp_32;
|
||||
#else
|
||||
typedef u_int32_t tcpiphdrp_32;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Tcp control block, one per tcp; fields:
|
||||
@@ -174,11 +178,15 @@ struct tcpcb {
|
||||
* port numbers (which are no longer needed once we've located the
|
||||
* tcpcb) are overlayed with an mbuf pointer.
|
||||
*/
|
||||
#ifdef __amd64__
|
||||
typedef uintptr_t mbufp_32;
|
||||
#else
|
||||
#if SIZEOF_CHAR_P == 4
|
||||
typedef struct SLIRPmbuf *mbufp_32;
|
||||
#else
|
||||
typedef u_int32_t mbufp_32;
|
||||
#endif
|
||||
#endif
|
||||
#define REASS_MBUF(ti) (*(mbufp_32 *)&((ti)->ti_t))
|
||||
|
||||
/*
|
||||
|
||||
@@ -559,6 +559,8 @@ static void lsi_disconnect(LSIState *s)
|
||||
{
|
||||
s->scntl1 &= ~LSI_SCNTL1_CON;
|
||||
s->sstat1 &= ~PHASE_MASK;
|
||||
if (s->dcmd & 0x01) /* Select with ATN */
|
||||
s->sstat1 |= 0x07;
|
||||
}
|
||||
|
||||
static void lsi_bad_selection(LSIState *s, uint32_t id)
|
||||
@@ -689,12 +691,18 @@ static lsi_request *lsi_find_by_tag(LSIState *s, uint32_t tag)
|
||||
static void lsi_request_free(LSIState *s, lsi_request *p)
|
||||
{
|
||||
if (p == s->current) {
|
||||
free(s->current);
|
||||
s->current = NULL;
|
||||
if (s->current) {
|
||||
free(s->current);
|
||||
s->current = NULL;
|
||||
return; /* If s->current is p, we do *NOT* need to free it a second time. */
|
||||
}
|
||||
} else {
|
||||
QTAILQ_REMOVE(&s->queue, p, next);
|
||||
}
|
||||
free(p);
|
||||
if (p) {
|
||||
free(p);
|
||||
p = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Callback to indicate that the SCSI layer has completed a command. */
|
||||
@@ -909,8 +917,10 @@ static void lsi_do_msgout(LSIState *s, uint8_t id)
|
||||
/* The ABORT TAG message clears the current I/O process only. */
|
||||
DPRINTF("MSG: ABORT TAG tag=0x%x\n", current_tag);
|
||||
if (current_req) {
|
||||
free(dev->CmdBuffer);
|
||||
dev->CmdBuffer = NULL;
|
||||
if (dev->CmdBuffer) {
|
||||
free(dev->CmdBuffer);
|
||||
dev->CmdBuffer = NULL;
|
||||
}
|
||||
}
|
||||
lsi_disconnect(s);
|
||||
break;
|
||||
@@ -935,8 +945,10 @@ static void lsi_do_msgout(LSIState *s, uint8_t id)
|
||||
|
||||
/* clear the current I/O process */
|
||||
if (s->current) {
|
||||
free(dev->CmdBuffer);
|
||||
dev->CmdBuffer = NULL;
|
||||
if (dev->CmdBuffer) {
|
||||
free(dev->CmdBuffer);
|
||||
dev->CmdBuffer = NULL;
|
||||
}
|
||||
}
|
||||
lsi_disconnect(s);
|
||||
break;
|
||||
@@ -1519,6 +1531,7 @@ static void lsi_reg_writeb(LSIState *s, uint32_t offset, uint8_t val)
|
||||
s->istat0 &= ~LSI_ISTAT0_INTF;
|
||||
lsi_update_irq(s);
|
||||
}
|
||||
|
||||
if (s->waiting == 1 && val & LSI_ISTAT0_SIGP) {
|
||||
DPRINTF("Woken by SIGP\n");
|
||||
s->waiting = 0;
|
||||
@@ -2227,7 +2240,10 @@ ncr53c810_close(void *priv)
|
||||
{
|
||||
LSIState *s = (LSIState *)priv;
|
||||
|
||||
free(s);
|
||||
if (s) {
|
||||
free(s);
|
||||
s = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
device_t ncr53c810_pci_device =
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# Makefile for Win32 (MinGW32) environment.
|
||||
#
|
||||
# Version: @(#)Makefile.mingw 1.0.83 2017/12/06
|
||||
# Version: @(#)Makefile.mingw 1.0.84 2017/12/13
|
||||
#
|
||||
# Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
# Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -30,6 +30,7 @@ AUTODEP := n
|
||||
endif
|
||||
ifndef CRASHDUMP
|
||||
CRASHDUMP := n
|
||||
CRASHDUMPOBJ := win_crashdump.o
|
||||
endif
|
||||
ifndef DEBUG
|
||||
DEBUG := n
|
||||
@@ -445,7 +446,7 @@ VIDOBJ := video.o \
|
||||
vid_voodoo.o
|
||||
|
||||
PLATOBJ := win.o \
|
||||
win_crashdump.o win_dynld.o win_thread.o $(WSERIAL) \
|
||||
$(CRASHDUMPOBJ) win_dynld.o win_thread.o $(WSERIAL) \
|
||||
win_cdrom.o win_cdrom_ioctl.o win_keyboard.o \
|
||||
win_mouse.o win_joystick.o win_midi.o
|
||||
|
||||
@@ -474,7 +475,9 @@ LIBS += $(WX_LIBS) -lz -lm
|
||||
endif
|
||||
LIBS += -lkernel32 -lwsock32 -liphlpapi -lpsapi
|
||||
LIBS += -lpthread -static -lstdc++ -lgcc
|
||||
ifneq ($(X64), y)
|
||||
LIBS += -Wl,--large-address-aware
|
||||
endif
|
||||
|
||||
|
||||
# Build module rules.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform main support module for Windows.
|
||||
*
|
||||
* Version: @(#)win.c 1.0.40 2017/12/04
|
||||
* Version: @(#)win.c 1.0.41 2017/12/13
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -241,13 +241,13 @@ CreateConsole(int init)
|
||||
}
|
||||
|
||||
h = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
i = _open_osfhandle((long)h, _O_TEXT);
|
||||
i = _open_osfhandle((intptr_t)h, _O_TEXT);
|
||||
fp = _fdopen(i, "w");
|
||||
setvbuf(fp, NULL, _IONBF, 1);
|
||||
*stdout = *fp;
|
||||
|
||||
h = GetStdHandle(STD_ERROR_HANDLE);
|
||||
i = _open_osfhandle((long)h, _O_TEXT);
|
||||
i = _open_osfhandle((intptr_t)h, _O_TEXT);
|
||||
fp = _fdopen(i, "w");
|
||||
setvbuf(fp, NULL, _IONBF, 1);
|
||||
*stderr = *fp;
|
||||
@@ -255,7 +255,7 @@ CreateConsole(int init)
|
||||
#if 0
|
||||
/* Set up stdin as well. */
|
||||
h = GetStdHandle(STD_INPUT_HANDLE);
|
||||
i = _open_osfhandle((long)h, _O_TEXT);
|
||||
i = _open_osfhandle((intptr_t)h, _O_TEXT);
|
||||
fp = _fdopen(i, "r");
|
||||
setvbuf(fp, NULL, _IONBF, 128);
|
||||
*stdin = *fp;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform support defintions for Win32.
|
||||
*
|
||||
* Version: @(#)win.h 1.0.11 2017/11/24
|
||||
* Version: @(#)win.h 1.0.12 2017/12/13
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -85,7 +85,7 @@ extern void keyboard_handle(LPARAM lParam, int infocus);
|
||||
extern void win_mouse_init(void);
|
||||
extern void win_mouse_close(void);
|
||||
|
||||
extern int fdd_type_to_icon(int type);
|
||||
extern intptr_t fdd_type_to_icon(int type);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern uint8_t deviceconfig_open(HWND hwnd, device_t *device);
|
||||
@@ -116,7 +116,7 @@ extern void StatusWindowCreate(HWND hwnd);
|
||||
|
||||
/* Functions in win_stbar.c: */
|
||||
extern HWND hwndSBAR;
|
||||
extern void StatusBarCreate(HWND hwndParent, int idStatus, HINSTANCE hInst);
|
||||
extern void StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst);
|
||||
|
||||
|
||||
/* Functions in win_dialog.c: */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle the About dialog.
|
||||
*
|
||||
* Version: @(#)win_about.c 1.0.4 2017/10/16
|
||||
* Version: @(#)win_about.c 1.0.5 2017/12/13
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -33,7 +33,11 @@
|
||||
#include "win.h"
|
||||
|
||||
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
AboutDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle generation of crash-dump reports.
|
||||
*
|
||||
* Version: @(#)win_crashdump.c 1.0.2 2017/11/12
|
||||
* Version: @(#)win_crashdump.c 1.0.3 2017/12/13
|
||||
*
|
||||
* Authors: Riley
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -194,9 +194,9 @@ LONG CALLBACK MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo)
|
||||
}
|
||||
BufPtr = &ExceptionHandlerBuffer[strlen(ExceptionHandlerBuffer) - 1];
|
||||
|
||||
#if defined(__i386__) && !defined(__x86_64)
|
||||
PCONTEXT Registers = ExceptionInfo->ContextRecord;
|
||||
|
||||
#if defined(__i386__) && !defined(__x86_64)
|
||||
/* This binary is being compiled for x86, include a register dump. */
|
||||
sprintf(BufPtr,
|
||||
"\r\n\r\nRegister dump:\r\n\r\n"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Rendering module for Microsoft Direct3D 9.
|
||||
*
|
||||
* Version: @(#)win_d3d.cpp 1.0.6 2017/11/25
|
||||
* Version: @(#)win_d3d.cpp 1.0.7 2017/12/13
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -360,8 +360,6 @@ d3d_init_objects(void)
|
||||
int
|
||||
d3d_init(HWND h)
|
||||
{
|
||||
int c;
|
||||
|
||||
d3d_hwnd = h;
|
||||
|
||||
cgapal_rebuild();
|
||||
@@ -401,7 +399,6 @@ int
|
||||
d3d_init_fs(HWND h)
|
||||
{
|
||||
WCHAR title[200];
|
||||
int c;
|
||||
|
||||
cgapal_rebuild();
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Windows device configuration dialog implementation.
|
||||
*
|
||||
* Version: @(#)win_devconf.c 1.0.10 2017/11/25
|
||||
* Version: @(#)win_devconf.c 1.0.11 2017/12/13
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -35,7 +35,11 @@ static device_t *config_device;
|
||||
static uint8_t deviceconfig_changed = 0;
|
||||
|
||||
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
@@ -480,7 +484,7 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
*data++ = 9; /*Point*/
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "Segoe UI", -1, data, 50);
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
while (config->type != -1)
|
||||
@@ -530,7 +534,7 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
/*Static text*/
|
||||
@@ -551,7 +555,7 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
data += MultiByteToWideChar(CP_ACP, 0, config->description, -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
y += 20;
|
||||
@@ -674,7 +678,7 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
break;
|
||||
}
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
config++;
|
||||
@@ -697,7 +701,7 @@ uint8_t deviceconfig_open(HWND hwnd, device_t *device)
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "OK", -1, data, 50);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Several dialogs for the application.
|
||||
*
|
||||
* Version: @(#)win_dialog.c 1.0.5 2017/11/18
|
||||
* Version: @(#)win_dialog.c 1.0.6 2017/12/13
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -128,14 +128,8 @@ ui_msgbox(int flags, void *arg)
|
||||
* higher than the numeric ID's. So, we guesswork
|
||||
* that if the value of 'arg' is low, its an ID..
|
||||
*/
|
||||
#if defined(__gcc__) && defined(__x86_64__)
|
||||
/* GCC, 64-bit mode. */
|
||||
if (((int64_t)arg) < ((int64_t)65636))
|
||||
#else
|
||||
/* Assume 32-bit mode. */
|
||||
if (((uint32_t)arg) < ((uint32_t)65636))
|
||||
#endif
|
||||
str = plat_get_string((int)arg);
|
||||
if (((uintptr_t)arg) < ((uintptr_t)65636))
|
||||
str = plat_get_string((intptr_t)arg);
|
||||
}
|
||||
|
||||
/* At any rate, we do have a valid (wide) string now. */
|
||||
|
||||
@@ -152,7 +152,12 @@ static int get_pov(HWND hdlg, int id)
|
||||
return axis_sel - nr_povs;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
joystickconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
int c;
|
||||
@@ -305,7 +310,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
|
||||
*data++ = 8; /*Point*/
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "MS Sans Serif", -1, data, 50);
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
|
||||
@@ -327,7 +332,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "Device", -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
/*Static text*/
|
||||
@@ -348,7 +353,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "Device :", -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
y += 20;
|
||||
@@ -374,7 +379,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
|
||||
data += MultiByteToWideChar(CP_ACP, 0, joystick_get_axis_name(type, c), -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
/*Static text*/
|
||||
@@ -395,7 +400,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
|
||||
data += MultiByteToWideChar(CP_ACP, 0, joystick_get_axis_name(type, c), -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
y += 20;
|
||||
@@ -421,7 +426,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
|
||||
data += MultiByteToWideChar(CP_ACP, 0, joystick_get_button_name(type, c), -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
/*Static text*/
|
||||
@@ -442,7 +447,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
|
||||
data += MultiByteToWideChar(CP_ACP, 0, joystick_get_button_name(type, c), -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
y += 20;
|
||||
@@ -474,7 +479,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
|
||||
data += MultiByteToWideChar(CP_ACP, 0, s, -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
/*Static text*/
|
||||
@@ -495,7 +500,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
|
||||
data += MultiByteToWideChar(CP_ACP, 0, s, -1, data, 256);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
y += 20;
|
||||
@@ -518,7 +523,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type)
|
||||
data += MultiByteToWideChar(CP_ACP, 0, "OK", -1, data, 50);
|
||||
*data++ = 0; /* no creation data */
|
||||
|
||||
if (((unsigned long)data) & 2)
|
||||
if (((uintptr_t)data) & 2)
|
||||
data++;
|
||||
|
||||
item = (DLGITEMTEMPLATE *)data;
|
||||
|
||||
@@ -49,12 +49,12 @@ void plat_midi_init()
|
||||
|
||||
m_event = CreateEvent(NULL, TRUE, TRUE, NULL);
|
||||
|
||||
hr = midiOutOpen(&midi_out_device, midi_id, (DWORD) m_event,
|
||||
hr = midiOutOpen(&midi_out_device, midi_id, (uintptr_t) m_event,
|
||||
0, CALLBACK_EVENT);
|
||||
if (hr != MMSYSERR_NOERROR) {
|
||||
printf("midiOutOpen error - %08X\n",hr);
|
||||
midi_id = 0;
|
||||
hr = midiOutOpen(&midi_out_device, midi_id, (DWORD) m_event,
|
||||
hr = midiOutOpen(&midi_out_device, midi_id, (uintptr_t) m_event,
|
||||
0, CALLBACK_EVENT);
|
||||
if (hr != MMSYSERR_NOERROR) {
|
||||
printf("midiOutOpen error - %08X\n",hr);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Windows 86Box Settings dialog handler.
|
||||
*
|
||||
* Version: @(#)win_settings.c 1.0.26 2017/12/09
|
||||
* Version: @(#)win_settings.c 1.0.27 2017/12/13
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
@@ -578,7 +578,12 @@ static void win_settings_machine_recalc_machine(HWND hdlg)
|
||||
}
|
||||
|
||||
|
||||
static BOOL CALLBACK win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
win_settings_machine_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
int c = 0;
|
||||
@@ -785,7 +790,12 @@ static void recalc_vid_list(HWND hdlg)
|
||||
}
|
||||
|
||||
|
||||
static BOOL CALLBACK win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
LPTSTR lptsTemp;
|
||||
@@ -923,7 +933,12 @@ static int mouse_valid(int num, int m)
|
||||
}
|
||||
|
||||
|
||||
static BOOL CALLBACK win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
wchar_t str[128];
|
||||
HWND h;
|
||||
@@ -1081,7 +1096,12 @@ int mpu401_standalone_allow(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
int c = 0;
|
||||
@@ -1321,7 +1341,12 @@ static BOOL CALLBACK win_settings_sound_proc(HWND hdlg, UINT message, WPARAM wPa
|
||||
}
|
||||
|
||||
|
||||
static BOOL CALLBACK win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
int c = 0;
|
||||
@@ -1496,7 +1521,12 @@ int find_irq_in_array(int irq, int def)
|
||||
}
|
||||
|
||||
|
||||
static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
int c = 0;
|
||||
@@ -1726,7 +1756,12 @@ static void network_recalc_combos(HWND hdlg)
|
||||
net_ignore_message = 0;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
int c = 0;
|
||||
@@ -2556,7 +2591,12 @@ static void recalc_selection(HWND hdlg)
|
||||
|
||||
static int chs_enabled = 0;
|
||||
|
||||
static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
int64_t i = 0;
|
||||
@@ -3285,7 +3325,12 @@ void hard_disk_add_open(HWND hwnd, int is_existing)
|
||||
|
||||
int ignore_change = 0;
|
||||
|
||||
static BOOL CALLBACK win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
win_settings_hard_disks_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
int old_sel = 0;
|
||||
@@ -3951,7 +3996,12 @@ static void cdrom_recalc_location_controls(HWND hdlg)
|
||||
|
||||
int rd_ignore_change = 0;
|
||||
|
||||
static BOOL CALLBACK win_settings_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
win_settings_removable_devices_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
int i = 0;
|
||||
@@ -4307,7 +4357,7 @@ static BOOL win_settings_main_image_list_init(HWND hwndList)
|
||||
|
||||
for (i = 0; i < 9; i++)
|
||||
{
|
||||
hiconItem = LoadIcon(hinstance, (LPCWSTR) (256 + i));
|
||||
hiconItem = LoadIcon(hinstance, (LPCWSTR) (256 + (uintptr_t) i));
|
||||
ImageList_AddIcon(hSmall, hiconItem);
|
||||
DestroyIcon(hiconItem);
|
||||
}
|
||||
@@ -4338,7 +4388,12 @@ static BOOL win_settings_main_insert_categories(HWND hwndList)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND h;
|
||||
int category;
|
||||
|
||||
@@ -31,7 +31,11 @@ extern uint64_t main_time;
|
||||
static uint64_t status_time;
|
||||
|
||||
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
StatusWindowProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
char temp[4096];
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implement the application's Status Bar.
|
||||
*
|
||||
* Version: @(#)win_stbar.c 1.0.6 2017/11/04
|
||||
* Version: @(#)win_stbar.c 1.0.7 2017/12/13
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -49,6 +49,10 @@
|
||||
#include "../ui.h"
|
||||
#include "win.h"
|
||||
|
||||
#ifndef GWL_WNDPROC
|
||||
#define GWL_WNDPROC GWLP_WNDPROC
|
||||
#endif
|
||||
|
||||
|
||||
HWND hwndSBAR;
|
||||
|
||||
@@ -66,7 +70,7 @@ static int sb_ready = 0;
|
||||
|
||||
|
||||
/* Also used by win_settings.c */
|
||||
int
|
||||
intptr_t
|
||||
fdd_type_to_icon(int type)
|
||||
{
|
||||
int ret = 512;
|
||||
@@ -789,7 +793,11 @@ StatusBarPopupMenu(HWND hwnd, POINT pt, int id)
|
||||
|
||||
|
||||
/* Handle messages for the Status Bar window. */
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WCHAR temp_path[1024];
|
||||
@@ -1004,10 +1012,11 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
/* API: Create and set up the Status Bar window. */
|
||||
void
|
||||
StatusBarCreate(HWND hwndParent, int idStatus, HINSTANCE hInst)
|
||||
StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
|
||||
{
|
||||
RECT rectDialog;
|
||||
int dw, dh, i;
|
||||
int dw, dh;
|
||||
uintptr_t i;
|
||||
|
||||
/* Load our icons into the cache for faster access. */
|
||||
for (i = 128; i < 130; i++)
|
||||
|
||||
Reference in New Issue
Block a user