search for: execution_buffer

Displaying 4 results from an estimated 4 matches for "execution_buffer".

2012 Jan 07
0
[LLVMdev] [llvm-commits] [PATCH][Compiler-rt] Windows implementation of mmap functionality in clear_cache_test and enable_execute_stack_test
Hi Ruben, > I see I missed some curly braces. I also modified spacing a tiny bit. Doesn't seem so. E.g. you have: + if ( !VirtualQuery(addr, &b, sizeof(b)) ) + exit(1); + if( !VirtualProtect(b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, &b.Protect) ) Add space after "if". Do not put spaces after "(" and before ")". Same for other
2012 Jan 07
2
[LLVMdev] [llvm-commits] [PATCH][Compiler-rt] Windows implementation of mmap functionality in clear_cache_test and enable_execute_stack_test
...ocess(), start, end-start)) + exit(1); +} +#else #include <sys/mman.h> +extern void __clear_cache(void* start, void* end); +#endif -extern void __clear_cache(void* start, void* end); typedef int (*pfunc)(void); @@ -38,21 +47,29 @@ // make executable the page containing execution_buffer char* start = (char*)((uintptr_t)execution_buffer & (-4095)); char* end = (char*)((uintptr_t)(&execution_buffer[128+4096]) & (-4095)); - if ( mprotect(start, end-start, PROT_READ|PROT_WRITE|PROT_EXEC) != 0 ) +#if defined(_WIN32) + DWORD dummy_oldProt; + MEMORY_BASIC_...
2012 Jan 07
3
[LLVMdev] [PATCH][Compiler-rt] Windows implementation of mmap functionality in clear_cache_test and enable_execute_stack_test
...urrentProcess(), start, end-start) ) + exit(1); +} +#else #include <sys/mman.h> +extern void __clear_cache(void* start, void* end); +#endif -extern void __clear_cache(void* start, void* end); - typedef int (*pfunc)(void); int func1() @@ -31,14 +39,23 @@ -unsigned char execution_buffer[128]; + int main() { + unsigned char execution_buffer[128]; // make executable the page containing execution_buffer char* start = (char*)((uintptr_t)execution_buffer & (-4095)); char* end = (char*)((uintptr_t)(&execution_buffer[128+4096]) & (-4095)); +#if defined(...
2012 Jan 07
1
[LLVMdev] [llvm-commits] [PATCH][Compiler-rt] Windows implementation of mmap functionality in clear_cache_test and enable_execute_stack_test
...ocess(), start, end-start) ) + exit(1); +} +#else #include <sys/mman.h> +extern void __clear_cache(void* start, void* end); +#endif -extern void __clear_cache(void* start, void* end); typedef int (*pfunc)(void); @@ -38,7 +47,15 @@ // make executable the page containing execution_buffer char* start = (char*)((uintptr_t)execution_buffer & (-4095)); char* end = (char*)((uintptr_t)(&execution_buffer[128+4096]) & (-4095)); +#if defined(_WIN32) + DWORD dummy_oldProt; + MEMORY_BASIC_INFORMATION b; + if ( !VirtualQuery(start, &b, sizeof(b)) ) +...