notaz.gp2x.de
/
pcsx_rearmed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix a mistake in big endian conversion
[pcsx_rearmed.git]
/
libpcsxcore
/
lightrec
/
mem.c
diff --git
a/libpcsxcore/lightrec/mem.c
b/libpcsxcore/lightrec/mem.c
index
efabdb0
..
9134d89
100644
(file)
--- a/
libpcsxcore/lightrec/mem.c
+++ b/
libpcsxcore/lightrec/mem.c
@@
-55,8
+55,12
@@
static void * mmap_huge(void *addr, size_t length, int prot, int flags,
if (map == MAP_FAILED) {
map = mmap(addr, length, prot, flags, fd, offset);
if (map == MAP_FAILED) {
map = mmap(addr, length, prot, flags, fd, offset);
- if (map != MAP_FAILED)
+ if (map != MAP_FAILED)
{
printf("Regular mmap to address 0x%lx succeeded\n", (uintptr_t) addr);
printf("Regular mmap to address 0x%lx succeeded\n", (uintptr_t) addr);
+#ifdef MADV_HUGEPAGE
+ madvise(map, length, MADV_HUGEPAGE);
+#endif
+ }
}
return map;
}
return map;
@@
-91,11
+95,16
@@
static int lightrec_mmap_ram(bool hugetlb)
base = supported_io_bases[i];
for (j = 0; j < 4; j++) {
base = supported_io_bases[i];
for (j = 0; j < 4; j++) {
- map = mmap_huge((void *)(base + j * 0x200000),
-
0x200000, PROT_READ | PROT_WRITE,
+ void *base_ptr = (void *)(base + j * 0x200000);
+
map = mmap_huge(base_ptr,
0x200000, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_FIXED_NOREPLACE, memfd, 0);
if (map == MAP_FAILED)
break;
MAP_SHARED | MAP_FIXED_NOREPLACE, memfd, 0);
if (map == MAP_FAILED)
break;
+ // some systems ignore MAP_FIXED_NOREPLACE
+ if (map != base_ptr) {
+ munmap(map, 0x200000);
+ break;
+ }
}
/* Impossible to map using this base */
}
/* Impossible to map using this base */