summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authornplourde <nplourde@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-27 02:44:06 +0000
committernplourde <nplourde@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-27 02:44:06 +0000
commitfc59977ac98900f763e1151bfce410c6b3d0c85b (patch)
treedfc65c5bc4d33e335fcef43afd05eb16b858e2d0 /loader
parentd4e86e6a118caa64353991a399962ae58c3a901d (diff)
downloadmpv-fc59977ac98900f763e1151bfce410c6b3d0c85b.tar.bz2
mpv-fc59977ac98900f763e1151bfce410c6b3d0c85b.tar.xz
fix compilation for win32 dll codec support for intel osx
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21306 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'loader')
-rw-r--r--loader/Makefile7
-rw-r--r--loader/ldt_keeper.c18
-rw-r--r--loader/module.c2
-rw-r--r--loader/stubs.S (renamed from loader/stubs.s)21
-rw-r--r--loader/wine/poppack.h4
5 files changed, 36 insertions, 16 deletions
diff --git a/loader/Makefile b/loader/Makefile
index 6b44a4a0f4..3a57723608 100644
--- a/loader/Makefile
+++ b/loader/Makefile
@@ -8,7 +8,12 @@ CFLAGS= -Idshow -DMPLAYER -D__WINE__ -DNOAVIFILE_HEADERS
SRCS= driver.c afl.c vfl.c
ifneq ($(TARGET_WIN32),yes)
SRCS+= ldt_keeper.c pe_image.c module.c ext.c win32.c \
- pe_resource.c resource.c registry.c elfdll.c wrapper.S stubs.s
+ pe_resource.c resource.c registry.c elfdll.c stubs.S
+endif
+
+# QTX emulation is not supported in Darwin
+ifneq ($(TARGET_OS),Darwin)
+SRCS+= wrapper.S
endif
SRCS+= dshow/DS_AudioDecoder.c \
diff --git a/loader/ldt_keeper.c b/loader/ldt_keeper.c
index fe270b6ba9..ec2de5dbd0 100644
--- a/loader/ldt_keeper.c
+++ b/loader/ldt_keeper.c
@@ -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 @@ struct modify_ldt_ldt_s {
#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 @@ static int LDT_Modify( int func, struct modify_ldt_ldt_s *ptr,
#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 @@ ldt_fs_t* Setup_LDT_Keeper(void)
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 @@ ldt_fs_t* Setup_LDT_Keeper(void)
}
#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 @@ ldt_fs_t* Setup_LDT_Keeper(void)
#endif
}
}
-#endif /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ */
+#endif /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __APPLE__ */
#if defined(__svr4__)
{
diff --git a/loader/module.c b/loader/module.c
index 9ab8fa66ec..bf0c385e30 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -10,7 +10,9 @@
*/
// define for quicktime calls debugging and/or MacOS-level emulation:
+#ifndef __APPLE__
#define EMU_QTX_API
+#endif /* __APPLE__ */
// define for quicktime debugging (verbose logging):
//#define DEBUG_QTX_API
diff --git a/loader/stubs.s b/loader/stubs.S
index 24d99aa9b4..141fd4502e 100644
--- a/loader/stubs.s
+++ b/loader/stubs.S
@@ -1,8 +1,13 @@
+#if defined(__APPLE__) || defined(__OpenBSD__)
+# define SYM(x) _ ## x
+#else
+# define SYM(x) x
+#endif
.data
-.LC0: .string "Called unk_%s\n"
- .balign 4
-.globl unk_exp1
-unk_exp1:
+.LC0: .asciz "Called unk_%s\n"
+ .p2align 4
+.globl SYM(unk_exp1)
+SYM(unk_exp1):
pushl %ebp
movl %esp,%ebp
subl $4,%esp
@@ -14,16 +19,16 @@ unk_exp1:
subl %eax,%edx
leal 0(,%edx,2),%eax
movl %eax,%edx
- addl $export_names,%edx
+ addl $SYM(export_names),%edx
pushl %edx
pushl $.LC0
- call printf
+ call SYM(printf)
addl $8,%esp
xorl %eax,%eax
leave
ret
-.globl exp_EH_prolog
-exp_EH_prolog:
+.globl SYM(exp_EH_prolog)
+SYM(exp_EH_prolog):
pushl $0xff
pushl %eax
pushl %fs:0
diff --git a/loader/wine/poppack.h b/loader/wine/poppack.h
index 7104791591..f297c1e744 100644
--- a/loader/wine/poppack.h
+++ b/loader/wine/poppack.h
@@ -1,9 +1,9 @@
#ifdef __WINE_PSHPACK_H
#undef __WINE_PSHPACK_H
-#if defined(__GNUC__) || defined(__SUNPRO_C)
+#if (defined(__GNUC__) || defined(__SUNPRO_C)) && !defined(__APPLE__)
#pragma pack()
-#elif defined(__SUNPRO_CC)
+#elif defined(__SUNPRO_CC) || defined(__APPLE__)
#warning "Assumes default alignment is 4"
#pragma pack(4)
#elif !defined(RC_INVOKED)