WARNING: CONFIGS MIGHT PARTIALLY BREAK WHERE DEVICE NAMES HAVE CHANGED.

Changes to device_t struct to accomodate the upcoming PCI IRQ arbitration rewrite;
Added device.c/h API to obtain name from the device_t struct;
Significant changes to win/win_settings.c to clean up the code a bit and fix bugs;
Ported all the CPU and AudioPCI commits from PCem;
Added an API call to allow ACPI soft power off to gracefully stop the emulator;
Removed the Siemens PCD-2L from the Dev branch because it now works;
Removed the Socket 5 HP Vectra from the Dev branch because it now works;
Fixed the Compaq Presario and the Micronics Spitfire;
Give the IBM PC330 its own list of 486 CPU so it can have DX2's with CPUID 0x470;
SMM fixes;
Rewrote the SYSENTER, SYSEXIT, SYSCALL, and SYSRET instructions;
Changed IDE reset period to match the specification, fixes #929;
The keyboard input and output ports are now forced in front of the queue when read, fixes a number of bugs, including the AMI Apollo hanging on soft reset;
Added the Intel AN430TX but Dev branched because it does not work;
The network code no longer drops packets if the emulated network card has failed to receive them (eg. when the buffer is full);
Changes to PCI card adding and renamed some PCI slot types, also added proper AGP bridge slot types;
USB UHCI emulation is no longer a stub (still doesn't fully work, but at least Windows XP chk with Debug no longer ASSERT's on it);
Fixed NVR on the the SMC FDC37C932QF and APM variants;
A number of fixes to Intel 4x0 chipsets, including fixing every register of the 440LX and 440EX;
Some ACPI changes.
This commit is contained in:
OBattler
2020-11-16 00:01:21 +01:00
parent 745460f64b
commit 0faf6692c9
260 changed files with 5122 additions and 4471 deletions

View File

@@ -67,8 +67,10 @@ static int dirty_list_size = 0;
static void block_free_list_add(codeblock_t *block)
{
#ifndef RELEASE_BUILD
if (block->flags & CODEBLOCK_IN_DIRTY_LIST)
fatal("block_free_list_add: block=%p in dirty list\n", block);
#endif
if (block_free_list)
block->next = block_free_list;
else
@@ -79,8 +81,10 @@ static void block_free_list_add(codeblock_t *block)
static void block_dirty_list_add(codeblock_t *block)
{
#ifndef RELEASE_BUILD
if (block->flags & CODEBLOCK_IN_DIRTY_LIST)
fatal("block_dirty_list_add: block=%p already in dirty list\n", block);
#endif
if (block_dirty_list_head != BLOCK_INVALID)
{
codeblock_t *old_head = &codeblock[block_dirty_list_head];
@@ -102,12 +106,14 @@ static void block_dirty_list_add(codeblock_t *block)
/*Evict oldest block to the free list*/
codeblock_t *evict_block = &codeblock[block_dirty_list_tail];
#ifndef RELEASE_BUILD
if (!(evict_block->flags & CODEBLOCK_IN_DIRTY_LIST))
fatal("block_dirty_list_add: evict_block=%p %x %x not in dirty list\n", evict_block, evict_block->phys, evict_block->flags);
if (!block_dirty_list_tail)
fatal("block_dirty_list_add - !block_dirty_list_tail\n");
if (evict_block->prev == BLOCK_INVALID)
fatal("block_dirty_list_add - evict_block->prev == BLOCK_INVALID\n");
#endif
block_dirty_list_tail = evict_block->prev;
codeblock[evict_block->prev].next = BLOCK_INVALID;
@@ -123,8 +129,10 @@ static void block_dirty_list_remove(codeblock_t *block)
codeblock_t *prev_block = &codeblock[block->prev];
codeblock_t *next_block = &codeblock[block->next];
#ifndef RELEASE_BUILD
if (!(block->flags & CODEBLOCK_IN_DIRTY_LIST))
fatal("block_dirty_list_remove: block=%p not in dirty list\n", block);
#endif
/*Is block head of list*/
if (block->prev == BLOCK_INVALID)
@@ -139,8 +147,10 @@ static void block_dirty_list_remove(codeblock_t *block)
next_block->prev = block->prev;
dirty_list_size--;
#ifndef RELEASE_BUILD
if (dirty_list_size < 0)
fatal("remove - dirty_list_size < 0!\n");
#endif
block->flags &= ~CODEBLOCK_IN_DIRTY_LIST;
}
@@ -170,9 +180,10 @@ static codeblock_t *block_free_list_get()
/*Free list is empty, check the dirty list*/
if (block_dirty_list_tail)
{
#ifndef RELEASE_BUILD
if (dirty_list_size <= 0)
fatal("get - dirty_list_size <= 0!\n");
#endif
/*Reuse oldest block*/
block = &codeblock[block_dirty_list_tail];
@@ -296,8 +307,10 @@ static void add_to_block_list(codeblock_t *block)
uint16_t block_prev_nr = pages[block->phys >> 12].block;
uint16_t block_nr = get_block_nr(block);
#ifndef RELEASE_BUILD
if (!block->page_mask)
fatal("add_to_block_list - mask = 0 %llx %llx\n", block->page_mask,block->page_mask2);
#endif
if (block_prev_nr)
{
@@ -313,8 +326,10 @@ static void add_to_block_list(codeblock_t *block)
if (block->next)
{
#ifndef RELEASE_BUILD
if (codeblock[block->next].pc == BLOCK_PC_INVALID)
fatal("block->next->pc=BLOCK_PC_INVALID %p %p %x %x\n", (void *)&codeblock[block->next], (void *)codeblock, block_current, block_pos);
#endif
}
if (block->page_mask2)
@@ -341,9 +356,10 @@ static void remove_from_block_list(codeblock_t *block, uint32_t pc)
{
if (!block->page_mask)
return;
#ifndef RELEASE_BUILD
if (block->flags & CODEBLOCK_IN_DIRTY_LIST)
fatal("remove_from_block_list: in dirty list\n");
#endif
if (block->prev)
{
codeblock[block->prev].next = block->next;
@@ -361,8 +377,10 @@ static void remove_from_block_list(codeblock_t *block, uint32_t pc)
if (!(block->flags & CODEBLOCK_HAS_PAGE2))
{
#ifndef RELEASE_BUILD
if (block->prev_2 || block->next_2)
fatal("Invalid block_2 %x %p %08x\n", block->flags, block, block->phys);
#endif
return;
}
block->flags &= ~CODEBLOCK_HAS_PAGE2;
@@ -387,11 +405,12 @@ static void invalidate_block(codeblock_t *block)
{
uint32_t old_pc = block->pc;
#ifndef RELEASE_BUILD
if (block->flags & CODEBLOCK_IN_DIRTY_LIST)
fatal("invalidate_block: already in dirty list\n");
if (block->pc == BLOCK_PC_INVALID)
fatal("Invalidating deleted block\n");
#endif
remove_from_block_list(block, old_pc);
block_dirty_list_add(block);
if (block->head_mem_block)
@@ -406,8 +425,10 @@ static void delete_block(codeblock_t *block)
if (block == &codeblock[codeblock_hash[HASH(block->phys)]])
codeblock_hash[HASH(block->phys)] = BLOCK_INVALID;
#ifndef RELEASE_BUILD
if (block->pc == BLOCK_PC_INVALID)
fatal("Deleting deleted block\n");
#endif
block->pc = BLOCK_PC_INVALID;
codeblock_tree_delete(block);
@@ -426,8 +447,10 @@ static void delete_dirty_block(codeblock_t *block)
if (block == &codeblock[codeblock_hash[HASH(block->phys)]])
codeblock_hash[HASH(block->phys)] = BLOCK_INVALID;
#ifndef RELEASE_BUILD
if (block->pc == BLOCK_PC_INVALID)
fatal("Deleting deleted block\n");
#endif
block->pc = BLOCK_PC_INVALID;
codeblock_tree_delete(block);
@@ -475,8 +498,10 @@ void codegen_check_flush(page_t *page, uint64_t mask, uint32_t phys_addr)
{
invalidate_block(block);
}
#ifndef RELEASE_BUILD
if (block_nr == next_block)
fatal("Broken 1\n");
#endif
block_nr = next_block;
}
@@ -491,8 +516,10 @@ void codegen_check_flush(page_t *page, uint64_t mask, uint32_t phys_addr)
{
invalidate_block(block);
}
#ifndef RELEASE_BUILD
if (block_nr == next_block)
fatal("Broken 2\n");
#endif
block_nr = next_block;
}
@@ -520,8 +547,10 @@ void codegen_block_init(uint32_t phys_addr)
if (!page->block)
mem_flush_write_page(phys_addr, cs+cpu_state.pc);
block = block_free_list_get();
#ifndef RELEASE_BUILD
if (!block)
fatal("codegen_block_init: block_free_list_get() returned NULL\n");
#endif
block_current = get_block_nr(block);
block_num = HASH(phys_addr);
@@ -560,8 +589,10 @@ void codegen_block_start_recompile(codeblock_t *block)
block_num = HASH(block->phys);
block_current = get_block_nr(block);//block->pnt;
#ifndef RELEASE_BUILD
if (block->pc != cs + cpu_state.pc || (block->flags & CODEBLOCK_WAS_RECOMPILED))
fatal("Recompile to used block!\n");
#endif
block->head_mem_block = codegen_allocator_allocate(NULL, block_current);
block->data = codeblock_allocator_get_ptr(block->head_mem_block);
@@ -668,6 +699,7 @@ void codegen_block_generate_end_mask_recompile()
if (!pages[block->phys_2 >> 12].block_2)
mem_flush_write_page(block->phys_2, codegen_endpc);
#ifndef RELEASE_BUILD
if (!block->page_mask2)
fatal("!page_mask2\n");
if (block->next_2)
@@ -675,6 +707,7 @@ void codegen_block_generate_end_mask_recompile()
if (codeblock[block->next_2].pc == BLOCK_PC_INVALID)
fatal("block->next_2->pc=BLOCK_PC_INVALID %p\n", (void *)&codeblock[block->next_2]);
}
#endif
}
else
{
@@ -695,8 +728,10 @@ void codegen_block_generate_end_mask_mark()
uint32_t end_pc;
page_t *p;
#ifndef RELEASE_BUILD
if (block->flags & CODEBLOCK_BYTE_MASK)
fatal("codegen_block_generate_end_mask2() - BYTE_MASK\n");
#endif
block->page_mask = 0;
start_pc = (block->pc & 0xfff) & ~63;
@@ -741,6 +776,7 @@ void codegen_block_generate_end_mask_mark()
if (!pages[block->phys_2 >> 12].block_2)
mem_flush_write_page(block->phys_2, codegen_endpc);
#ifndef RELEASE_BUILD
if (!block->page_mask2)
fatal("!page_mask2\n");
if (block->next_2)
@@ -748,7 +784,7 @@ void codegen_block_generate_end_mask_mark()
if (codeblock[block->next_2].pc == BLOCK_PC_INVALID)
fatal("block->next_2->pc=BLOCK_PC_INVALID %p\n", (void *)&codeblock[block->next_2]);
}
#endif
block->dirty_mask2 = &page_2->dirty_mask;
}
else