changeset 21368:06a0a4dbf1a0

Get rid of stubs.S, move code to inline asm.
author reimar
date Wed, 29 Nov 2006 12:56:52 +0000
parents 731278c42d6c
children 9d42ff736ea5
files loader/Makefile loader/stubs.S loader/win32.c
diffstat 3 files changed, 21 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/loader/Makefile	Wed Nov 29 12:55:17 2006 +0000
+++ b/loader/Makefile	Wed Nov 29 12:56:52 2006 +0000
@@ -8,7 +8,7 @@
 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 stubs.S
+       pe_resource.c resource.c registry.c elfdll.c
 # QTX emulation is not supported in Darwin
 ifneq ($(TARGET_OS),Darwin)
 SRCS+= wrapper.S
--- a/loader/stubs.S	Wed Nov 29 12:55:17 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-#if defined(__APPLE__)
-# define SYM(x) _ ## x
-#else
-# define SYM(x) x
-#endif
-	.data
-.globl SYM(exp_EH_prolog)
-SYM(exp_EH_prolog):
-	pushl $0xff
-	pushl %eax
-	pushl %fs:0
-	movl  %esp, %fs:0
-	movl  12(%esp), %eax
-	movl  %ebp, 12(%esp)
-	leal  12(%esp), %ebp
-	pushl %eax
-	ret
--- a/loader/win32.c	Wed Nov 29 12:55:17 2006 +0000
+++ b/loader/win32.c	Wed Nov 29 12:56:52 2006 +0000
@@ -18,6 +18,7 @@
  */
 
 #include "config.h"
+#include "mangle.h"
 
 #ifdef MPLAYER
 #ifdef USE_QTX_CODECS
@@ -4587,8 +4588,25 @@
 
 /* these are needed for mss1 */
 
-/* defined in stubs.s */
-void exp_EH_prolog(void);
+/**
+ * \brief this symbol is defined within exp_EH_prolog_dummy
+ * \param dest jump target
+ */
+void exp_EH_prolog(void *dest);
+//! just a dummy function that acts a container for the asm section
+void exp_EH_prolog_dummy(void) {
+  asm volatile (
+// take care, this "function" may not change flags or
+// registers besides eax (which is also why we can't use
+// exp_EH_prolog_dummy directly)
+MANGLE(exp_EH_prolog)":    \n\t"
+    "pop   %eax            \n\t"
+    "push  %ebp            \n\t"
+    "mov   %esp, %ebp      \n\t"
+    "lea   -12(%esp), %esp \n\t"
+    "jmp   *%eax           \n\t"
+  );
+}
 
 #include <netinet/in.h>
 static WINAPI inline unsigned long int exphtonl(unsigned long int hostlong)