Fix passing arg9 (qvm only), arg10, and arg11 to vmMain for native libs and non-i386 compiled or interpated qvms. (Currently they aren't use in vmMain in game, cgame, or ui.)

Fix passing args[11] to args[15] from vm to engine on ppc64 and sparc64. Some of the args are used by game bot prediction syscalls. May have been causing bugs. Note: This was fixed for x86_64 in r2163.
This commit is contained in:
Zack Middleton 2012-12-15 21:55:07 +00:00
parent b943d506bf
commit c5af65fe5f
7 changed files with 43 additions and 53 deletions

View file

@ -416,7 +416,7 @@ static void DoSyscall(void)
int *data;
#if idx64
int index;
intptr_t args[16];
intptr_t args[MAX_VMSYSCALL_ARGS];
#endif
data = (int *) (savedVM->dataBase + vm_programStack + 4);
@ -1714,6 +1714,7 @@ int VM_CallCompiled(vm_t *vm, int *args)
byte *image;
int *opStack;
int opStackOfs;
int arg;
currentVM = vm;
@ -1726,18 +1727,11 @@ int VM_CallCompiled(vm_t *vm, int *args)
// set up the stack frame
image = vm->dataBase;
programStack -= 48;
programStack -= ( 8 + 4 * MAX_VMMAIN_ARGS );
for ( arg = 0; arg < MAX_VMMAIN_ARGS; arg++ )
*(int *)&image[ programStack + 8 + arg * 4 ] = args[ arg ];
*(int *)&image[ programStack + 44] = args[9];
*(int *)&image[ programStack + 40] = args[8];
*(int *)&image[ programStack + 36] = args[7];
*(int *)&image[ programStack + 32] = args[6];
*(int *)&image[ programStack + 28] = args[5];
*(int *)&image[ programStack + 24] = args[4];
*(int *)&image[ programStack + 20] = args[3];
*(int *)&image[ programStack + 16] = args[2];
*(int *)&image[ programStack + 12] = args[1];
*(int *)&image[ programStack + 8 ] = args[0];
*(int *)&image[ programStack + 4 ] = 0; // return stack
*(int *)&image[ programStack ] = -1; // will terminate the loop on return
@ -1799,7 +1793,7 @@ int VM_CallCompiled(vm_t *vm, int *args)
{
Com_Error(ERR_DROP, "opStack corrupted in compiled code");
}
if(programStack != stackOnEntry - 48)
if(programStack != stackOnEntry - (8 + 4 * MAX_VMMAIN_ARGS))
Com_Error(ERR_DROP, "programStack corrupted in compiled code");
vm->programStack = stackOnEntry;