Merge remote-tracking branch 'upstream/master' into feature/mtrr

This commit is contained in:
Jasmine Iwanek
2022-10-27 04:08:59 -04:00
6 changed files with 37 additions and 15 deletions

View File

@@ -267,6 +267,7 @@ void codegen_block_init(uint32_t phys_addr)
void codegen_block_start_recompile(codeblock_t *block)
{
page_t *page = &pages[block->phys >> 12];
uintptr_t rip_rel;
if (!page->block[(block->phys >> 10) & 3])
mem_flush_write_page(block->phys, cs+cpu_state.pc);
@@ -298,15 +299,17 @@ void codegen_block_start_recompile(codeblock_t *block)
while (block_pos < BLOCK_EXIT_OFFSET)
addbyte(0x90); /*NOP*/
#else
addbyte(0xc6); /* mov byte ptr[&(cpu_state.abrt)],ABRT_GPF */
addbyte(0x05);
addlong((uint32_t) (uintptr_t) &(cpu_state.abrt));
addbyte(0xC6); /*MOVB ABRT_GPF,(abrt)*/
addbyte(0x45);
addbyte((uint8_t)cpu_state_offset(abrt));
addbyte(ABRT_GPF);
addbyte(0x31); /* xor eax,eax */
addbyte(0xc0);
addbyte(0x67); /* mov [&(abrt_error)],eax */
addbyte(0xa3);
addlong((uint32_t) (uintptr_t) &(abrt_error));
addbyte(0x89); /*MOVB eax,(abrt_error)*/
addbyte(0x85);
rip_rel = ((uintptr_t)&cpu_state) + 128;
rip_rel = ((uintptr_t) &(abrt_error)) - rip_rel;
addlong((uint32_t) rip_rel);
#endif
block_pos = BLOCK_EXIT_OFFSET; /*Exit code*/
addbyte(0x48); /*ADDL $40,%rsp*/

View File

@@ -11,7 +11,7 @@
#ifdef OLD_GPF
#define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 20)
#else
#define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 15)
#define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 12)
#endif
#define BLOCK_MAX 1620

View File

@@ -73,6 +73,9 @@ enum {
/* Make sure this is as low as possible. */
cpu_state_t cpu_state;
/* Place this immediately after. */
uint32_t abrt_error;
#ifdef USE_DYNAREC
const OpFn *x86_dynarec_opcodes, *x86_dynarec_opcodes_0f,
*x86_dynarec_opcodes_d8_a16, *x86_dynarec_opcodes_d8_a32,

View File

@@ -41,8 +41,6 @@ uint8_t opcode2;
int cgate16, cgate32;
int intgatesize;
uint32_t abrt_error;
void taskswitch286(uint16_t seg, uint16_t *segdat, int is32);
void pmodeint(int num, int soft);

View File

@@ -60,6 +60,24 @@ typedef struct upc_t {
serial_t *uart[2];
} upc_t;
#ifdef ENABLE_F82C710_LOG
int f82c710_do_log = ENABLE_F82C710_LOG;
static void
f82c710_log(const char *fmt, ...)
{
va_list ap;
if (f82c710_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
}
#else
# define f82c710_log(fmt, ...)
#endif
static void
f82c710_update_ports(upc_t *dev, int set)
{
@@ -171,28 +189,28 @@ f82c606_update_ports(upc_t *dev, int set)
if (dev->regs[0] & 1) {
gameport_remap(dev->gameport, ((uint16_t) dev->regs[7]) << 2);
pclog("Game port at %04X\n", ((uint16_t) dev->regs[7]) << 2);
f82c710_log("Game port at %04X\n", ((uint16_t) dev->regs[7]) << 2);
}
if (dev->regs[0] & 2) {
serial_setup(dev->uart[0], ((uint16_t) dev->regs[4]) << 2, uart1_int);
pclog("UART 1 at %04X, IRQ %i\n", ((uint16_t) dev->regs[4]) << 2, uart1_int);
f82c710_log("UART 1 at %04X, IRQ %i\n", ((uint16_t) dev->regs[4]) << 2, uart1_int);
}
if (dev->regs[0] & 4) {
serial_setup(dev->uart[1], ((uint16_t) dev->regs[5]) << 2, uart2_int);
pclog("UART 2 at %04X, IRQ %i\n", ((uint16_t) dev->regs[5]) << 2, uart2_int);
f82c710_log("UART 2 at %04X, IRQ %i\n", ((uint16_t) dev->regs[5]) << 2, uart2_int);
}
if (dev->regs[0] & 8) {
lpt1_init(((uint16_t) dev->regs[6]) << 2);
lpt1_irq(lpt1_int);
pclog("LPT1 at %04X, IRQ %i\n", ((uint16_t) dev->regs[6]) << 2, lpt1_int);
f82c710_log("LPT1 at %04X, IRQ %i\n", ((uint16_t) dev->regs[6]) << 2, lpt1_int);
}
nvr_at_handler(1, ((uint16_t) dev->regs[3]) << 2, dev->nvr);
nvr_irq_set(nvr_int, dev->nvr);
pclog("RTC at %04X, IRQ %i\n", ((uint16_t) dev->regs[3]) << 2, nvr_int);
f82c710_log("RTC at %04X, IRQ %i\n", ((uint16_t) dev->regs[3]) << 2, nvr_int);
}
static uint8_t

View File

@@ -298,7 +298,7 @@ else
endif
endif
ifeq ($(DEBUG), y)
DFLAGS += -ggdb -DDEBUG -DUSE_ACYCS
DFLAGS += -ggdb -DDEBUG
AOPTIM :=
ifndef COPTIM
COPTIM := -Og