about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-12-15 17:48:49 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-12-15 17:48:49 +0100
commit42441c99cc4ef1e262a0f50e39c4056cc173c1e9 (patch)
treee8b851172620cf0bfa4ba8bb31c55c11db2fb6c1 /src
parentf7754740625b6f1749ee77e09f05956aa146f30b (diff)
downloadbox64-42441c99cc4ef1e262a0f50e39c4056cc173c1e9.tar.gz
box64-42441c99cc4ef1e262a0f50e39c4056cc173c1e9.zip
[BOX32][WRAPPER] More fixes on 32bits libc wrapping
Diffstat (limited to 'src')
-rw-r--r--src/libtools/libc_net32.c10
-rwxr-xr-xsrc/wrapped32/wrappedlibc.c3
-rwxr-xr-xsrc/wrapped32/wrappedlibc_private.h6
3 files changed, 17 insertions, 2 deletions
diff --git a/src/libtools/libc_net32.c b/src/libtools/libc_net32.c
index 55681a5f..9bb4118f 100644
--- a/src/libtools/libc_net32.c
+++ b/src/libtools/libc_net32.c
@@ -21,6 +21,7 @@
 #include <ifaddrs.h>
 #include <net/if.h>
 #include <resolv.h>
+#include <netinet/in.h>
 
 #include "box64stack.h"
 #include "x64emu.h"
@@ -633,3 +634,12 @@ EXPORT int my32_ns_parserr(x64emu_t* emu, my_ns_msg_32_t* handle, uint32_t secti
     convert_ns_msg_to_32(handle, &handle_l);
     return ret;
 }
+
+EXPORT struct in6_addr my32_in6addr_any;
+EXPORT struct in6_addr my32_in6addr_loopback;
+
+void libc32_net_init()
+{
+    my32_in6addr_any = in6addr_any;
+    my32_in6addr_loopback = in6addr_loopback;
+}
\ No newline at end of file
diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c
index b0ba7c52..82ffca71 100755
--- a/src/wrapped32/wrappedlibc.c
+++ b/src/wrapped32/wrappedlibc.c
@@ -3304,11 +3304,14 @@ extern void* my__IO_2_1_stderr_;
 extern void* my__IO_2_1_stdin_ ;
 extern void* my__IO_2_1_stdout_;
 
+void libc32_net_init();
+
 #define CUSTOM_INIT         \
     box64->libclib = lib;   \
     my_lib = lib;           \
     InitCpuModel();         \
     ctSetup();              \
+    libc32_net_init();      \
     /*obstackSetup();*/     \
     my32_environ = my32__environ = my32___environ = box64->envv32;          \
     my32___progname_full = my32_program_invocation_name = box64->argv[0];   \
diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h
index 481f77af..5a2390ec 100755
--- a/src/wrapped32/wrappedlibc_private.h
+++ b/src/wrapped32/wrappedlibc_private.h
@@ -2,6 +2,8 @@
 #error Meh...
 #endif
 
+//DATA not M cannot work on libc wbecause it's loaded in high memory
+
 // FILE* is S
 // locale_t needs special handling, with to_locale / from_locale (and is a / A)
 // struct utimbuf is: LL
@@ -671,8 +673,8 @@ GO(iconv_open, pEpp)
 GO(if_nametoindex, uEp)
 // imaxabs  // Weak
 GOWS(imaxdiv, pEpII) //%%
-DATA(in6addr_any, 16)  // type R
-DATA(in6addr_loopback, 16) // type R
+DATAM(in6addr_any, 16)  // type R
+DATAM(in6addr_loopback, 16) // type R
 // inb  // Weak
 //GOW(index, pEpi)
 // inet6_opt_append