From f0ab35132b412b3dfd6e65fe51a01180963c3914 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 18 Aug 2023 03:16:37 +0200 Subject: [PATCH] Always allocate 16 more bytes of RAM to mitigate potential segmentation faults on certain accessed by the old recompilers. --- src/mem/mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mem/mem.c b/src/mem/mem.c index 46826361b..088d15f51 100644 --- a/src/mem/mem.c +++ b/src/mem/mem.c @@ -2695,7 +2695,7 @@ mem_reset(void) } memset(ram, 0x00, ram_size); ram2_size = m - (1 << 30); - ram2 = (uint8_t *) plat_mmap(ram2_size, 0); /* allocate and clear the RAM block above 1 GB */ + ram2 = (uint8_t *) plat_mmap(ram2_size + 16, 0); /* allocate and clear the RAM block above 1 GB */ if (ram2 == NULL) { if (config_changed == 2) fatal(EMU_NAME " must be restarted for the memory amount change to be applied.\n"); @@ -2708,7 +2708,7 @@ mem_reset(void) #endif { ram_size = m; - ram = (uint8_t *) plat_mmap(ram_size, 0); /* allocate and clear the RAM block */ + ram = (uint8_t *) plat_mmap(ram_size + 16, 0); /* allocate and clear the RAM block */ if (ram == NULL) { fatal("Failed to allocate RAM block. Make sure you have enough RAM available.\n"); return;