From: MichaƂ Januszewski Date: Sun, 7 Sep 2008 23:35:30 +0000 (+0200) Subject: Map the VRAM and Video ROM/System ROM seperately. X-Git-Tag: v86d-0.1.7~1 X-Git-Url: https://repo.or.cz/w/v86d.git/commitdiff_plain/88d10f8179d33dae46cb696a8d4f5aa751f240d7 Map the VRAM and Video ROM/System ROM seperately. lrmi maps both the Video RAM and ROM with PROT_EXEC. This can cause problems on systems with NX and PaX. In order to avoid these, map the RAM and ROM areas separately, with different PROT_* flags. --- diff --git a/libs/lrmi-0.10/lrmi.c b/libs/lrmi-0.10/lrmi.c index c68d753..de75e75 100644 --- a/libs/lrmi-0.10/lrmi.c +++ b/libs/lrmi-0.10/lrmi.c @@ -347,14 +347,23 @@ LRMI_init(void) return 0; } - if (!map_file((void *)0xa0000, 0x100000 - 0xa0000, - PROT_READ | PROT_WRITE | PROT_EXEC, + if (!map_file((void *)0xa0000, 0x20000, + PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, "/dev/mem", 0xa0000)) { munmap((void *)0, 0x502); real_mem_deinit(); return 0; } + if (!map_file((void *)0xc0000, 0x30000, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_FIXED | MAP_SHARED, "/dev/mem", 0xc0000)) { + munmap((void *)0, 0x502); + munmap((void *)0xa0000, 0x20000); + real_mem_deinit(); + return 0; + } + /* Allocate a stack */