From 90ce4873a2bddc12792abdf836c404bbd9d80d1b Mon Sep 17 00:00:00 2001 From: theoddone33 <> Date: Tue, 4 May 2004 23:53:18 +0000 Subject: [PATCH] Add the name of the start address to the error message when mprotect fails. --- zsnes/src/linux/protect.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zsnes/src/linux/protect.c b/zsnes/src/linux/protect.c index 15edb634..85e5a87f 100644 --- a/zsnes/src/linux/protect.c +++ b/zsnes/src/linux/protect.c @@ -126,8 +126,10 @@ extern void NewGfxAsmEnd(); extern void VCacheAsmStart(); extern void VCacheAsmEnd(); +#define MakeCodeWriteable(a, b) MakeCodeWriteable_f (a, b, #a) + // Thanks QuakeForge -void MakeCodeWriteable (unsigned long startaddr, unsigned long length) +void MakeCodeWriteable_f (unsigned long startaddr, unsigned long length, const char *name) { int r; unsigned int addr; @@ -141,7 +143,7 @@ void MakeCodeWriteable (unsigned long startaddr, unsigned long length) r = mprotect ((char *) addr, length + startaddr - addr + psize, PROT_READ | PROT_WRITE | PROT_EXEC); if (r < 0) - fprintf (stderr, "Error! Memory *NOT* unprotected. startaddr = 0x%08lx\n", startaddr); + fprintf (stderr, "Error! Memory *NOT* unprotected. startaddr = 0x%08lx (%s)\n", startaddr, name); }