From bd8196414c3642bb770f55aa4141dc6d2f12cf35 Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Thu, 1 Jan 2004 12:39:53 +0000 Subject: [PATCH] Fix for visual c startup assembly code Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1516 --- src/cpu/core_dyn_x86/risc_x86.h | 52 ++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/src/cpu/core_dyn_x86/risc_x86.h b/src/cpu/core_dyn_x86/risc_x86.h index 8d149ba5..6f482fcb 100644 --- a/src/cpu/core_dyn_x86/risc_x86.h +++ b/src/cpu/core_dyn_x86/risc_x86.h @@ -74,31 +74,13 @@ public: static Bit32u kut=10; static BlockReturn gen_runcode(Bit8u * code) { BlockReturn retval; - #define NEW_MASK $FMASK_TEST - __asm__ volatile ( - - "pushfl \n" - "movl %1,%%ebx \n" - "andl %2,%%ebx \n" - "popl %%ecx \n" - "andl %3,%%ecx \n" - "orl %%ebx,%%ecx \n" - "pushl %%ecx \n" - "popfl \n" - "call %4 \n" - "pushfl \n" - "movl %1,%%ebx \n" - "andl %3,%%ebx \n" - "popl %%ecx \n" - "andl %2,%%ecx \n" - "orl %%ecx,%%ebx \n" - "movl %%ebx,%1 \n" - :"=a" (retval) - :"m" (reg_flags), "n" (FMASK_TEST),"n" (~FMASK_TEST),"m" (code) - :"%ecx","%edx","%ebx","%ebp","%edi","%esi","cc","memory" - ); -#if 0 +#if defined (_MSC_VER) + __asm { /* Prepare the flags */ + push ebx + push ebp + push esi + push edi pushfd mov ebx,[reg_flags] and ebx,FMASK_TEST @@ -122,6 +104,28 @@ static BlockReturn gen_runcode(Bit8u * code) { pop ebx mov [retval],eax } +#else + __asm__ volatile ( + "pushfl \n" + "movl %1,%%ebx \n" + "andl %2,%%ebx \n" + "popl %%ecx \n" + "andl %3,%%ecx \n" + "orl %%ebx,%%ecx \n" + "pushl %%ecx \n" + "popfl \n" + "call %4 \n" + "pushfl \n" + "movl %1,%%ebx \n" + "andl %3,%%ebx \n" + "popl %%ecx \n" + "andl %2,%%ecx \n" + "orl %%ecx,%%ebx \n" + "movl %%ebx,%1 \n" + :"=a" (retval) + :"m" (reg_flags), "n" (FMASK_TEST),"n" (~FMASK_TEST),"m" (code) + :"%ecx","%edx","%ebx","%ebp","%edi","%esi","cc","memory" + ); #endif return retval; }