Did temp fix to allow dynarec to work

Also forgot a NULL check. I hate pointers sometimes...
This commit is contained in:
Michael J. Manley
2022-01-16 22:15:27 -08:00
parent e863318fce
commit bc59a414b5
2 changed files with 8 additions and 4 deletions

View File

@@ -304,7 +304,11 @@ static inline void exec_interpreter(void)
cpu_end_block_after_ins = 0; cpu_end_block_after_ins = 0;
} }
static inline void exec_recompiler(void) /* TODO: Look in deeper for why, but this is to fix crashing. Somehow a function is being optimized out, causing
* a SEGFAULT
*/
static inline void __attribute__((optimize("O0"))) exec_recompiler(void)
{ {
uint32_t phys_addr = get_phys(cs+cpu_state.pc); uint32_t phys_addr = get_phys(cs+cpu_state.pc);
int hash = HASH(phys_addr); int hash = HASH(phys_addr);
@@ -393,12 +397,12 @@ static inline void exec_recompiler(void)
if (valid_block && (block->flags & CODEBLOCK_WAS_RECOMPILED)) if (valid_block && (block->flags & CODEBLOCK_WAS_RECOMPILED))
{ {
void (*code)() = (void *)&block->data[BLOCK_START]; void (*code)() = (void *)&block->data[BLOCK_START]; // FIX: This seems to get optimized out, I tried making volatile but still segfaulted
// if (output) pclog("Run block at %04x:%04x %04x %04x %04x %04x %04x %04x ESP=%08x %04x %08x %08x %016llx %08x\n", CS, pc, AX, BX, CX, DX, SI, DI, ESP, BP, get_phys(cs+pc), block->phys, block->page_mask, block->endpc); // if (output) pclog("Run block at %04x:%04x %04x %04x %04x %04x %04x %04x ESP=%08x %04x %08x %08x %016llx %08x\n", CS, pc, AX, BX, CX, DX, SI, DI, ESP, BP, get_phys(cs+pc), block->phys, block->page_mask, block->endpc);
inrecomp=1; inrecomp=1;
code(); code();
inrecomp=0; inrecomp=0;
cpu_recomp_blocks++; cpu_recomp_blocks++;

View File

@@ -282,7 +282,7 @@ int video_card_getid(char *s)
{ {
int c = 0; int c = 0;
while (video_cards[c]->device) while (video_cards[c] != NULL && video_cards[c]->device)
{ {
if (!strcmp(video_cards[c]->name, s)) if (!strcmp(video_cards[c]->name, s))
return c; return c;