[quake3-commits] r1996 - trunk/code/qcommon

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed May 18 12:06:08 EDT 2011


Author: thilo
Date: 2011-05-18 12:06:08 -0400 (Wed, 18 May 2011)
New Revision: 1996

Modified:
   trunk/code/qcommon/vm_x86.c
Log:
Fix VM call for release version, bug introduced by myself in r1994


Modified: trunk/code/qcommon/vm_x86.c
===================================================================
--- trunk/code/qcommon/vm_x86.c	2011-05-18 00:17:02 UTC (rev 1995)
+++ trunk/code/qcommon/vm_x86.c	2011-05-18 16:06:08 UTC (rev 1996)
@@ -1491,6 +1491,7 @@
 */
 int	VM_CallCompiled( vm_t *vm, int *args ) {
 	int		stack[1024];
+	void	*entryPoint;
 	int		programCounter;
 	int		programStack;
 	int		stackOnEntry;
@@ -1527,36 +1528,28 @@
 	*(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" );



More information about the quake3-commits mailing list