OpenSWE1R / openswe1r

An Open-Source port of the 1999 Game "Star Wars Episode 1: Racer"
https://openswe1r.github.io/
GNU General Public License v2.0
312 stars 26 forks source link

Random memory access to 0x1FBEFCFE #169

Closed JayFoxRox closed 5 years ago

JayFoxRox commented 5 years ago

This only happens in the KVM CPU backend (or the unicorn backend gracefully ignores it?). This log is for "Game version: Patched, English"

I've modified OpenSWE1R to trigger this problem manually:

static uint32_t stackAddress = 0xC0000000;
static uint32_t stackSize = 1 * 1024 * 1024;

#define HEAP_ADDRESS 0x02000000
static uint32_t heapAddress = HEAP_ADDRESS;
static uint32_t heapSize = 40 * 1024 * 1024; // Our allocation can not ovelap 0x1FBEFCFE

After a wave of:

hHeap 0x555
dwFlags 0x0
dwBytes 0x480
Heap-use: 5156864 / 41943040 = 12%
Stack at 0xC007FEF0; returning EAX: 0x024EA000
     75 Emulation at 49F332 ('HeapAlloc') from 49F332

There is:

rax: 0x00000800
rbx: 0x557b420a
rcx: 0x00000000
rdx: 0x00000800
rsi: 0x00000000
rdi: 0x004a3c79
rsp: 0xc007ff2c
rbp: 0x1fbefcfe
rip: 0x004a3f0d
rflags: 0x00010006
=====================
cr0: 0x0000000060000011
cr2: 0x0000000000000000
cr3: 0x0000000000000000
cr4: 0x0000000000000000
cr8: 0x0000000000000000
gdt: 0x0018:0xfffff000
cs: 0x00000000 ds: 0x00000000 es: 0x00000000
fs: 0xb0000000 gs: 0x00000000 ss: 0x00000000
Error accessing 0x1FBEFCFE