From 24ec7446266ff2fae00ddc6124d8d3237ec1841d Mon Sep 17 00:00:00 2001 From: Lucas Fryzek Date: Wed, 7 Aug 2024 08:07:39 +0100 Subject: wrap: Fix crashing from missing mmap offset --- src/wrap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/wrap.c') diff --git a/src/wrap.c b/src/wrap.c index 7115b53..2801211 100644 --- a/src/wrap.c +++ b/src/wrap.c @@ -210,7 +210,7 @@ static void clear_mem(struct mem_entry *mem) { || heap == PVR_HEAP_PDS_VERTEX_CODE_DATA || heap == PVR_HEAP_PDS_PIXEL_CODE_DATA || heap == PVR_HEAP_GENERAL - //|| heap == PVR_HEAP_KERNEL_DATA + || heap == PVR_HEAP_KERNEL_DATA || heap == PVR_HEAP_PERCONTEXT_3DPARAMETERS || heap == PVR_HEAP_SYNC_INFO || heap == PVR_HEAP_TA_DATA; @@ -250,7 +250,7 @@ static struct mem_entry *add_mmap_pointer(void* data, int prot, size_t length, u for (int j = 0; j < 2; j++) { if (mem->in_use && mem->has_mmap[j]) { if (mem->mmap_data[j].uiMMapOffset == pgoffset && mem->mmap_data[j].uiRealByteSize == length) { - mem->data[j] = data; + mem->data[j] = data + mem->mmap_data[j].uiByteOffset; mem->prot[j] = prot; return mem; } @@ -1103,7 +1103,7 @@ long syscall(long number, ...) { va_end(args); long ret = orig_syscall(number, addr, length, prot, flags, fd, pgoffset); if (is_pvr(fd)) { - printf("mmap2 called with 0x%lx 0x%x 0x%x %x\n", ret, flags, addr, pgoffset); + printf("mmap2 called with 0x%lx 0x%lx 0x%lx %lx\n", ret, flags, addr, pgoffset); last_mem_entry = add_mmap_pointer((void*)ret, prot, length, pgoffset); clear_mem(last_mem_entry); } -- cgit