summaryrefslogtreecommitdiff
path: root/include/ruby/win32.h
diff options
context:
space:
mode:
authorU.Nakamura <usa@ruby-lang.org>2021-12-27 15:56:23 +0900
committerU.Nakamura <usa@ruby-lang.org>2021-12-27 15:56:23 +0900
commit85a426dc8678f04a78ffd799943b690ce2984c49 (patch)
treedb4a2ccd3de67b69651ccbe66830ff313150072e /include/ruby/win32.h
parentf486566f133ae191c6f9d5ff0001abf8efc9984f (diff)
Tiny mmap emulation for Windows
- prerequisite of supporting YJIT with VC++. - note that now can specfily `--yjit` on mswin64, but not enabled YJIT'ed code because of YJIT requires `OPT_DIRECT_THREADED_CODE` or `OPT_CALL_THREADED_CODE` in `rb_yjit_compile_iseq`.
Diffstat (limited to 'include/ruby/win32.h')
-rw-r--r--include/ruby/win32.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/ruby/win32.h b/include/ruby/win32.h
index c8ae599f2f..287ac34270 100644
--- a/include/ruby/win32.h
+++ b/include/ruby/win32.h
@@ -796,6 +796,25 @@ double rb_w32_pow(double x, double y);
#define pow rb_w32_pow
#endif
+// mmap tiny emulation
+#define MAP_FAILED ((void *)-1)
+
+#define PROT_READ 0x01
+#define PROT_WRITE 0x02
+#define PROT_EXEC 0x04
+
+#define MAP_PRIVATE 0x0002
+#define MAP_ANON 0x1000
+#define MAP_ANONYMOUS MAP_ANON
+
+extern void *rb_w32_mmap(void *, size_t, int, int, int, off_t);
+extern int rb_w32_munmap(void *, size_t);
+extern int rb_w32_mprotect(void *, size_t, int);
+
+#define mmap(a, l, p, f, d, o) rb_w32_mmap(a, l, p, f, d, o)
+#define munmap(a, l) rb_w32_munmap(a. l)
+#define mprotect(a, l, p) 0
+
#if defined(__cplusplus)
#if 0
{ /* satisfy cc-mode */