mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-06 15:51:25 +00:00
well, that was interesting: turns out mingw provides mprotect and
getpagesize :/
This commit is contained in:
parent
c38ca8e2f1
commit
6f022f5d9f
1 changed files with 8 additions and 8 deletions
|
@ -234,7 +234,14 @@ Sys_DoubleTime (void)
|
||||||
void
|
void
|
||||||
Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
|
Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_MPROTECT
|
#ifdef _WIN32
|
||||||
|
DWORD flOldProtect;
|
||||||
|
|
||||||
|
if (!VirtualProtect
|
||||||
|
((LPVOID) startaddr, length, PAGE_READWRITE,
|
||||||
|
&flOldProtect)) Sys_Error ("Protection change failed\n");
|
||||||
|
#else
|
||||||
|
# ifdef HAVE_MPROTECT
|
||||||
int r;
|
int r;
|
||||||
unsigned long addr;
|
unsigned long addr;
|
||||||
int psize = getpagesize ();
|
int psize = getpagesize ();
|
||||||
|
@ -248,13 +255,6 @@ Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
|
||||||
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
Sys_Error ("Protection change failed\n");
|
Sys_Error ("Protection change failed\n");
|
||||||
#else
|
|
||||||
# ifdef HAVE_VIRTUALPROTECT
|
|
||||||
DWORD flOldProtect;
|
|
||||||
|
|
||||||
if (!VirtualProtect
|
|
||||||
((LPVOID) startaddr, length, PAGE_READWRITE,
|
|
||||||
&flOldProtect)) Sys_Error ("Protection change failed\n");
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue