diff options
author | Thilo Schulz <arny@ats.s.bawue.de> | 2011-05-18 16:06:08 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-09 22:29:03 +0000 |
commit | 7d736c703961c40671b39c928924f761cfc0a16d (patch) | |
tree | 7aa2e926bdf298c6c1cbfad1a428b0effb9dbd10 /src/qcommon/vm_x86.c | |
parent | ac239c1631484de3045a6019cd2abf3cada34f2c (diff) |
Fix VM call for release version, bug introduced by myself in r1994
Diffstat (limited to 'src/qcommon/vm_x86.c')
-rw-r--r-- | src/qcommon/vm_x86.c | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/src/qcommon/vm_x86.c b/src/qcommon/vm_x86.c index 47c8b6c1..e1ba73a0 100644 --- a/src/qcommon/vm_x86.c +++ b/src/qcommon/vm_x86.c @@ -1492,6 +1492,7 @@ This function is called directly by the generated code */ int VM_CallCompiled( vm_t *vm, int *args ) { int stack[1024]; + void *entryPoint; int programCounter; int programStack; int stackOnEntry; @@ -1528,36 +1529,28 @@ int VM_CallCompiled( vm_t *vm, int *args ) { *(int *)&image[ programStack ] = -1; // will terminate the loop on return // off we go into generated code... + entryPoint = vm->codeBase + vm->entryOfs; opStack = &stack; - { #ifdef _MSC_VER - void *entryPoint = vm->codeBase + vm->entryOfs; - - __asm { - pushad - mov esi, programStack - mov edi, opStack - call entryPoint - mov programStack, esi - mov opStack, edi - popad - } + __asm + { + pushad + mov esi, programStack + mov edi, opStack + call entryPoint + mov programStack, esi + mov opStack, edi + popad + } #else - __asm__ volatile( - "pushal\r\n" - "movl %0, %%esi\r\n" - "movl %1, %%edi\r\n" - "call *%2\r\n" - "movl %%edi, %1\r\n" - "movl %%esi, %0\r\n" - "popal\r\n" - : "+g" (programStack), "+g" (opStack) - : "g" (vm->codeBase + vm->entryOfs) - : "cc", "memory" - ); + __asm__ volatile( + "call *%2\r\n" + : "+S" (programStack), "+D" (opStack) + : "r" (vm->codeBase + vm->entryOfs) + : "cc", "memory", "%eax", "%ebx", "%ecx", "%edx" + ); #endif - } if ( opStack != &stack[1] ) { Com_Error( ERR_DROP, "opStack corrupted in compiled code" ); |