From 823ae23e8a20173d6d01ba3522f27432f083acd5 Mon Sep 17 00:00:00 2001 From: Lucas Fryzek Date: Wed, 7 Aug 2024 23:01:16 +0100 Subject: wrap: Allow spoofing of address to figure PDSPixelCodeData encoding --- src/wrap.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/wrap.c b/src/wrap.c index 0d350eb..d85a05a 100644 --- a/src/wrap.c +++ b/src/wrap.c @@ -102,6 +102,7 @@ static struct fd_info { bool open; bool is_pvr; } fds[MAX_FDS]; +static int current_alloc = 0; #if 0 static FILE *log_file; @@ -578,11 +579,16 @@ static void pvrsrv_ioctl_post(int fd, PVRSRV_BRIDGE_PACKAGE *bridge_package, int PVRSRV_BRIDGE_IN_ALLOCDEVICEMEM *in = bridge_package->pvParamIn; PVRSRV_BRIDGE_OUT_ALLOCDEVICEMEM *mem_data = bridge_package->pvParamOut; PVRSRV_CLIENT_MEM_INFO *mem = &mem_data->sClientMemInfo; + if (current_alloc == 73) { + printf("Offsetting alloc #73\n"); + mem->sDevVAddr.uiAddr = 0xf407000; + } track_buffer(mem, MEM_TYPE_NORMAL); printf("Alloc %p\n", mem->hKernelMemInfo); if (!(in->ui32Attribs & PVRSRV_MEM_NO_SYNCOBJ)) printf("Allocating sync as well\n"); + current_alloc++; } break; case _IOC_NR(PVRSRV_BRIDGE_MHANDLE_TO_MMAP_DATA): @@ -670,13 +676,6 @@ static bool pvrsrv_ioctl(int fd, PVRSRV_BRIDGE_PACKAGE *bridge_package) { case _IOC_NR(PVRSRV_BRIDGE_ALLOC_DEVICEMEM): { PVRSRV_BRIDGE_IN_ALLOCDEVICEMEM *mem_data = bridge_package->pvParamIn; - static int current_alloc = 0; -#if 0 - if (mem_data->hDevMemHeap == 0x3 && mem_data->uSize == 262144) { - create_buffer(fd, bridge_package, mem_data->hDevCookie, 0x3, 262144, 9, 4); - printf("Created buffer to offset\n"); - } -#endif /* Before buffer is allocated, allocate an identical buffer so addresses will be offset */ char *realloc = getenv("REALLOC"); @@ -685,17 +684,18 @@ static bool pvrsrv_ioctl(int fd, PVRSRV_BRIDGE_PACKAGE *bridge_package) { mem_data->uSize, mem_data->ui32Attribs, mem_data->uAlignment); -#if 0 - if (current_alloc == 5) { - printf("Dupped this buffer!\n"); - create_buffer(fd, bridge_package, mem_data->hDevCookie, (uintptr_t)mem_data->hDevMemHeap, - mem_data->uSize, mem_data->ui32Attribs, mem_data->uAlignment); + char *realloc_buf = getenv("REALLOC_BUF"); + if (realloc_buf) { + int buf = atoi(realloc_buf); + if (buf != 0 && current_alloc == buf) { + printf("Dupped this buffer!\n"); + create_buffer(fd, bridge_package, mem_data->hDevCookie, (uintptr_t)mem_data->hDevMemHeap, + mem_data->uSize, mem_data->ui32Attribs, mem_data->uAlignment); + } } -#endif PPRINT(stdout, mem_data, PVRSRV_BRIDGE_IN_ALLOCDEVICEMEM); printf("Alloc #%d %p\n", current_alloc, mem_data); - current_alloc++; } break; case _IOC_NR(PVRSRV_BRIDGE_SGX_REGISTER_HW_RENDER_CONTEXT): -- cgit