diff options
author | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-08-07 08:07:54 +0100 |
---|---|---|
committer | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-08-07 08:07:54 +0100 |
commit | f560eafc67f5a3824dbb42e50c8cd8ce7481963a (patch) | |
tree | 732e193b576f124f4a3b3c7d5fb14772d0fa1363 /src/drv.c | |
parent | 24ec7446266ff2fae00ddc6124d8d3237ec1841d (diff) |
drv: Fix mmap to return successfully
Diffstat (limited to 'src/drv.c')
-rw-r--r-- | src/drv.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -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); } |