Fix minor build issue with madvise flags.

This commit is contained in:
David Guillen Fandos 2019-05-12 13:40:18 +02:00
parent 6cba98b70a
commit 55e7c17030
2 changed files with 5 additions and 4 deletions

View File

@ -478,7 +478,7 @@ bool _vmem_reserve() {
{0x00800000, 0x01000000, MAP_ARAM_START_OFFSET, ARAM_SIZE, false}, // Aica, wraps too
{0x20000000, 0x20000000+ARAM_SIZE, MAP_ARAM_START_OFFSET, ARAM_SIZE, true},
{0x01000000, 0x04000000, 0, 0, false}, // More unused
{0x04000000, 0x05000000, MAP_VRAM_START_OFFSET, VRAM_SIZE, true}, // Area 1 (vram, 16MB, wrapped on DC)
{0x04000000, 0x05000000, MAP_VRAM_START_OFFSET, VRAM_SIZE, true}, // Area 1 (vram, 16MB, wrapped on DC as 2x8MB)
{0x05000000, 0x06000000, 0, 0, false}, // 32 bit path (unused)
{0x06000000, 0x07000000, MAP_VRAM_START_OFFSET, VRAM_SIZE, true}, // VRAM mirror
{0x07000000, 0x08000000, 0, 0, false}, // 32 bit path (unused) mirror

View File

@ -141,10 +141,11 @@ void vmem_platform_reset_mem(void *ptr, unsigned size_bytes) {
mprotect(ptr, size_bytes, PROT_NONE);
// Tell the kernel to flush'em all (FIXME: perhaps unmap+mmap 'd be better?)
madvise(ptr, size_bytes, MADV_DONTNEED);
#ifdef MADV_REMOVE
#if defined(MADV_REMOVE)
madvise(ptr, size_bytes, MADV_REMOVE);
#endif
madvise(ptr, size_bytes, MADV_FREE);
#elif defined(MADV_FREE)
madvise(ptr, size_bytes, MADV_FREE);
#endif
}
// Allocates a bunch of memory (page aligned and page-sized)