diff loader/ldt_keeper.c @ 21290:efc774a1e5a4

fix compilation for win32 dll codec support for intel osx
author nplourde
date Mon, 27 Nov 2006 02:44:06 +0000
parents 2de480457872
children 363c84953547
line wrap: on
line diff
--- a/loader/ldt_keeper.c	Mon Nov 27 02:20:15 2006 +0000
+++ b/loader/ldt_keeper.c	Mon Nov 27 02:44:06 2006 +0000
@@ -29,6 +29,8 @@
 #include <stdio.h>
 #include <unistd.h>
 #include "osdep/mmap_anon.h"
+#include "mp_msg.h"
+#include "help_mp.h"
 #ifdef __linux__
 #include <asm/unistd.h>
 #include <asm/ldt.h>
@@ -103,8 +105,9 @@
 #define       LDT_SEL(idx) ((idx) << 3 | 1 << 2 | 3)
 
 /* i got this value from wine sources, it's the first free LDT entry */
-#if defined(__FreeBSD__) && defined(LDT_AUTO_ALLOC)
+#if (defined(__APPLE__) || defined(__FreeBSD__)) && defined(LDT_AUTO_ALLOC)
 #define       TEB_SEL_IDX     LDT_AUTO_ALLOC
+#define	      USE_LDT_AA
 #endif
 
 #ifndef       TEB_SEL_IDX
@@ -168,7 +171,7 @@
 #endif
 #endif
 
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
 static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content )
 {
     *buffer++ = ((content->base_addr & 0x0000ffff) << 16) |
@@ -195,6 +198,11 @@
     if (!ldt_fs)
 	return NULL;
 
+#ifdef __APPLE__
+    if (getenv("DYLD_BIND_AT_LAUNCH") == NULL)
+        mp_msg(MSGT_LOADER, MSGL_WARN, MSGTR_LOADER_DYLD_Warning);
+#endif /* __APPLE__ */
+    
     fs_seg=
     ldt_fs->fs_seg = mmap_anon(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE, 0);
     if (ldt_fs->fs_seg == (void*)-1)
@@ -223,12 +231,12 @@
     }
 #endif /*linux*/
 
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
     {
         unsigned long d[2];
 
         LDT_EntryToBytes( d, &array );
-#if defined(__FreeBSD__) && defined(LDT_AUTO_ALLOC)
+#ifdef USE_LDT_AA
         ret = i386_set_ldt(LDT_AUTO_ALLOC, (union descriptor *)d, 1);
         array.entry_number = ret;
         fs_ldt = ret;
@@ -245,7 +253,7 @@
 #endif
         }
     }
-#endif  /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ */
+#endif  /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __APPLE__ */
 
 #if defined(__svr4__)
     {