sourcehook/sh_memory.h
changeset 50 4b6bbaf375dc
parent 34 11e62a912700
child 61 f9b4e9ded36d
     1.1 --- a/sourcehook/sh_memory.h	Sun May 01 14:30:52 2005 +0000
     1.2 +++ b/sourcehook/sh_memory.h	Sun May 01 18:04:18 2005 +0000
     1.3 @@ -35,7 +35,7 @@
     1.4  // We need to align addr down to pagesize on linux
     1.5  // We assume PAGESIZE is a power of two
     1.6  #		define SH_LALIGN(x) (void*)((int)(x) & ~(PAGESIZE-1))
     1.7 -
     1.8 +#		define SH_LALDIF(x) ((int)(x) & (PAGESIZE-1))
     1.9  # else
    1.10  #		error Unsupported OS/Compiler
    1.11  # endif
    1.12 @@ -46,7 +46,7 @@
    1.13  	inline bool SetMemAccess(void *addr, size_t len, int access)
    1.14  	{
    1.15  # ifdef __linux__
    1.16 -		return mprotect(SH_LALIGN(addr), len, access)==0 ? true : false;
    1.17 +		return mprotect(SH_LALIGN(addr), len + SH_LALDIF(addr), access)==0 ? true : false;
    1.18  # else
    1.19  		DWORD tmp;
    1.20  		DWORD prot;