Fix VM call for release version, bug introduced by myself in r1994

This commit is contained in:
Thilo Schulz 2011-05-18 16:06:08 +00:00
parent 61d6e6eb68
commit a42239e1e5

View file

@ -1491,6 +1491,7 @@ This function is called directly by the generated code
*/ */
int VM_CallCompiled( vm_t *vm, int *args ) { int VM_CallCompiled( vm_t *vm, int *args ) {
int stack[1024]; int stack[1024];
void *entryPoint;
int programCounter; int programCounter;
int programStack; int programStack;
int stackOnEntry; int stackOnEntry;
@ -1527,13 +1528,12 @@ int VM_CallCompiled( vm_t *vm, int *args ) {
*(int *)&image[ programStack ] = -1; // will terminate the loop on return *(int *)&image[ programStack ] = -1; // will terminate the loop on return
// off we go into generated code... // off we go into generated code...
entryPoint = vm->codeBase + vm->entryOfs;
opStack = &stack; opStack = &stack;
{
#ifdef _MSC_VER #ifdef _MSC_VER
void *entryPoint = vm->codeBase + vm->entryOfs; __asm
{
__asm {
pushad pushad
mov esi, programStack mov esi, programStack
mov edi, opStack mov edi, opStack
@ -1544,19 +1544,12 @@ int VM_CallCompiled( vm_t *vm, int *args ) {
} }
#else #else
__asm__ volatile( __asm__ volatile(
"pushal\r\n"
"movl %0, %%esi\r\n"
"movl %1, %%edi\r\n"
"call *%2\r\n" "call *%2\r\n"
"movl %%edi, %1\r\n" : "+S" (programStack), "+D" (opStack)
"movl %%esi, %0\r\n" : "r" (vm->codeBase + vm->entryOfs)
"popal\r\n" : "cc", "memory", "%eax", "%ebx", "%ecx", "%edx"
: "+g" (programStack), "+g" (opStack)
: "g" (vm->codeBase + vm->entryOfs)
: "cc", "memory"
); );
#endif #endif
}
if ( opStack != &stack[1] ) { if ( opStack != &stack[1] ) {
Com_Error( ERR_DROP, "opStack corrupted in compiled code" ); Com_Error( ERR_DROP, "opStack corrupted in compiled code" );