Displaying 5 results from an estimated 5 matches for "__enable_execute_stack".
2012 Jan 07
3
[LLVMdev] [PATCH][Compiler-rt] Windows implementation of mmap functionality in clear_cache_test and enable_execute_stack_test
...py)
@@ -11,12 +11,27 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
+#if defined(_WIN32)
+#include <windows.h>
+void __clear_cache(void* start, void* end)
+{
+ if( !FlushInstructionCache(GetCurrentProcess(), start, end-start) )
+ abort();
+}
+void __enable_execute_stack(void *addr)
+{
+ MEMORY_BASIC_INFORMATION b;
+
+ if ( !VirtualQuery(addr, &b, sizeof(b)) )
+ exit(1);
+ if( !VirtualProtect(b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, &b.Protect) )
+ exit(1);
+}
+#else
#include <sys/mman.h>
-
-
-
extern void __clea...
2012 Jan 07
1
[LLVMdev] [llvm-commits] [PATCH][Compiler-rt] Windows implementation of mmap functionality in clear_cache_test and enable_execute_stack_test
...py)
@@ -11,12 +11,27 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
+#if defined(_WIN32)
+#include <windows.h>
+void __clear_cache(void* start, void* end)
+{
+ if( !FlushInstructionCache(GetCurrentProcess(), start, end-start) )
+ exit(1);
+}
+void __enable_execute_stack(void *addr)
+{
+ MEMORY_BASIC_INFORMATION b;
+
+ if ( !VirtualQuery(addr, &b, sizeof(b)) )
+ exit(1);
+ if( !VirtualProtect(b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, &b.Protect) )
+ exit(1);
+}
+#else
#include <sys/mman.h>
-
-
-
extern void __clear_...
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
...opy)
@@ -11,12 +11,27 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
+#if defined(_WIN32)
+#include <windows.h>
+void __clear_cache(void* start, void* end)
+{
+ if (!FlushInstructionCache(GetCurrentProcess(), start, end-start))
+ exit(1);
+}
+void __enable_execute_stack(void *addr)
+{
+ MEMORY_BASIC_INFORMATION b;
+
+ if (!VirtualQuery(addr, &b, sizeof(b)))
+ exit(1);
+ if (!VirtualProtect(b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, &b.Protect))
+ exit(1);
+}
+#else
#include <sys/mman.h>
-
-
-
extern void __clear_cac...
2013 Jun 25
0
[LLVMdev] [PATCH] Windows implementation of enable_execute_stack
...lt;sys/mman.h>
>> > +#else
>> > +#include <windows.h>
>> > +#endif
>> >
>> > /* #include "config.h"
>> > * FIXME: CMake - include when cmake system is ready.
>> > @@ -38,7 +42,7 @@
>> >
>> > void __enable_execute_stack(void* addr)
>> > {
>> > -
>> > +#ifndef _WIN32
>> > #if __APPLE__
>> > /* On Darwin, pagesize is always 4096 bytes */
>> > const uintptr_t pageSize = 4096;
>> > @@ -54,6 +58,14 @@
>> > unsigned char* endPage = (unsigned...