From f560eafc67f5a3824dbb42e50c8cd8ce7481963a Mon Sep 17 00:00:00 2001 From: Lucas Fryzek Date: Wed, 7 Aug 2024 08:07:54 +0100 Subject: drv: Fix mmap to return successfully --- src/drv.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/drv.c') diff --git a/src/drv.c b/src/drv.c index 9733ac3..e5737e8 100644 --- a/src/drv.c +++ b/src/drv.c @@ -337,13 +337,12 @@ static struct mem_alloc allocate_memobj(struct driver_state *state, PVRSRV_BRIDG PPRINT(stdout, &out2, PVRSRV_BRIDGE_OUT_MHANDLE_TO_MMAP_DATA); - printf("Attempting map 0x%x, 0x%x\n", out2.uiRealByteSize, out2.uiMMapOffset); - //mem.data = mmap2(NULL, out2.uiRealByteSize, PROT_READ|PROT_WRITE, - // MAP_SHARED, state->fd, out2.uiMMapOffset); - mem.data = syscall(SYS_mmap2, NULL, out2.uiRealByteSize, - PROT_READ | PROT_WRITE, MAP_SHARED, - state->fd, out2.uiRealByteSize); + printf("Attempting map 0x%x, 0x%x\n", (uint32_t)out2.uiRealByteSize, (uint32_t)out2.uiMMapOffset); + mem.data = (void*)(uintptr_t)syscall(SYS_mmap2, NULL, out2.uiRealByteSize, + PROT_READ | PROT_WRITE, MAP_SHARED, + state->fd, out2.uiMMapOffset); + mem.data += out2.uiByteOffset; assert(mem.data != MAP_FAILED); memset(mem.data, 0x00, out.sClientMemInfo.uAllocSize); } -- cgit