Commit 272e2587 by Richard Kenner

(_trampoline): Rework last change; both getpagesize and mprotect are

in cygwin32.

From-SVN: r14636
parent b080c137
...@@ -2718,9 +2718,7 @@ __clear_cache (char *beg, char *end) ...@@ -2718,9 +2718,7 @@ __clear_cache (char *beg, char *end)
/* Jump to a trampoline, loading the static chain address. */ /* Jump to a trampoline, loading the static chain address. */
#ifdef WINNT #if defined(WINNT) && ! defined(__CYGWIN32__)
#ifndef __CYGWIN32__
long getpagesize() long getpagesize()
{ {
...@@ -2731,28 +2729,32 @@ long getpagesize() ...@@ -2731,28 +2729,32 @@ long getpagesize()
#endif #endif
} }
#endif
#ifdef i386 #ifdef i386
extern int VirtualProtect (char *, int, int, int *) __attribute__((stdcall)); extern int VirtualProtect (char *, int, int, int *) __attribute__((stdcall));
#endif #endif
int mprotect(char *addr, int len, int prot) int
mprotect (char *addr, int len, int prot)
{ {
int np, op; int np, op;
if (prot == 7) np = 0x40; if (prot == 7)
else if (prot == 5) np = 0x20; np = 0x40;
else if (prot == 4) np = 0x10; else if (prot == 5)
else if (prot == 3) np = 0x04; np = 0x20;
else if (prot == 1) np = 0x02; else if (prot == 4)
else if (prot == 0) np = 0x01; np = 0x10;
else if (prot == 3)
np = 0x04;
else if (prot == 1)
np = 0x02;
else if (prot == 0)
np = 0x01;
if (VirtualProtect (addr, len, np, &op)) if (VirtualProtect (addr, len, np, &op))
return 0; return 0;
else else
return -1; return -1;
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment