Add the name of the start address to the error message when mprotect fails.

This commit is contained in:
theoddone33
2004-05-04 23:53:18 +00:00
parent a719095394
commit 90ce4873a2

View File

@@ -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);
}