瀏覽代碼

rtasm: Play nicely with Windows's Data Execution Prevention.

tags/mesa-7.7-1
José Fonseca 16 年之前
父節點
當前提交
66c1de77ed
共有 1 個文件被更改,包括 30 次插入2 次删除
  1. 30
    2
      src/gallium/auxiliary/rtasm/rtasm_execmem.c

+ 30
- 2
src/gallium/auxiliary/rtasm/rtasm_execmem.c 查看文件

@@ -41,6 +41,12 @@
#define MAP_ANONYMOUS MAP_ANON
#endif

#if defined(PIPE_OS_WINDOWS)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <windows.h>
#endif

#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)

@@ -118,7 +124,29 @@ rtasm_exec_free(void *addr)
}


#else /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */
#elif defined(PIPE_OS_WINDOWS)


/*
* Avoid Data Execution Prevention.
*/

void *
rtasm_exec_malloc(size_t size)
{
return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
}


void
rtasm_exec_free(void *addr)
{
VirtualFree(addr, 0, MEM_RELEASE);
}


#else


/*
* Just use regular memory.
@@ -138,4 +166,4 @@ rtasm_exec_free(void *addr)
}


#endif /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */
#endif

Loading…
取消
儲存