about summary refs log tree commit diff stats
path: root/src/include/os.h
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-04-09 01:12:55 +0800
committerGitHub <noreply@github.com>2025-04-08 19:12:55 +0200
commitd592c1996d74e9e6e728026486cdab6a75f43aaa (patch)
tree935f142dff05d4640f2cd5865f8d63f8c3ca8cf9 /src/include/os.h
parent8b3d4404d77bcc806631e17038f046d409cb6b69 (diff)
downloadbox64-d592c1996d74e9e6e728026486cdab6a75f43aaa.tar.gz
box64-d592c1996d74e9e6e728026486cdab6a75f43aaa.zip
[WOW64] Add wow64 PE build scaffolding (#2513)
Diffstat (limited to 'src/include/os.h')
-rw-r--r--src/include/os.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/include/os.h b/src/include/os.h
index 6968df19..2ab70722 100644
--- a/src/include/os.h
+++ b/src/include/os.h
@@ -2,6 +2,37 @@
 #define __OS_H_
 
 #include <stdint.h>
+#include <sys/types.h>
+
+#ifndef _WIN32
+#include <dlfcn.h>
+#include <sys/mman.h>
+#else
+typedef __int64 ssize_t;
+
+#define PROT_READ  0x1
+#define PROT_WRITE 0x2
+#define PROT_EXEC  0x4
+
+#define MAP_FAILED    ((void*)-1)
+#define MAP_PRIVATE   0x02
+#define MAP_FIXED     0x10
+#define MAP_ANONYMOUS 0x20
+#define MAP_32BIT     0x40
+#define MAP_NORESERVE 0
+
+void* mmap(void* addr, size_t length, int prot, int flags, int fd, off_t offset);
+int munmap(void* addr, size_t length);
+int mprotect(void* addr, size_t len, int prot);
+
+void* WinMalloc(size_t size);
+void* WinRealloc(void* ptr, size_t size);
+void* WinCalloc(size_t nmemb, size_t size);
+void WinFree(void* ptr);
+#endif
+
+void* InternalMmap(void* addr, unsigned long length, int prot, int flags, int fd, ssize_t offset);
+int InternalMunmap(void* addr, unsigned long length);
 
 int GetTID(void);
 int SchedYield(void);
@@ -17,6 +48,8 @@ int IsBridgeSignature(char s, char c);
 int IsNativeCall(uintptr_t addr, int is32bits, uintptr_t* calladdress, uint16_t* retn);
 void EmuInt3(void* emu, void* addr);
 void* EmuFork(void* emu, int forktype);
+
+void PersonalityAddrLimit32Bit(void);
 // ----------------------------------------------------------------
 
 #ifndef _WIN32