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

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Nov 1 14:58:16 EST 2009


Author: ludwig
Date: 2009-11-01 14:58:16 -0500 (Sun, 01 Nov 2009)
New Revision: 1720

Modified:
   trunk/code/qcommon/vm_x86_64_assembler.c
Log:
implement immediate argument for call

Modified: trunk/code/qcommon/vm_x86_64_assembler.c
===================================================================
--- trunk/code/qcommon/vm_x86_64_assembler.c	2009-11-01 19:58:12 UTC (rev 1719)
+++ trunk/code/qcommon/vm_x86_64_assembler.c	2009-11-01 19:58:16 UTC (rev 1720)
@@ -811,24 +811,34 @@
 {
 	u8 rex, modrm, sib;
 
-	if(arg1.type != T_REGISTER || arg2.type != T_NONE)
+	if((arg1.type != T_REGISTER && arg1.type != T_IMMEDIATE) || arg2.type != T_NONE)
 		CRAP_INVALID_ARGS;
 
-	if(!arg1.absolute)
-		crap("call must be absolute");
+	if(arg1.type == T_REGISTER)
+	{
+		if(!arg1.absolute)
+			crap("call must be absolute");
 
-	if((arg1.v.reg & R_64) != R_64)
-		crap("register must be 64bit");
+		if((arg1.v.reg & R_64) != R_64)
+			crap("register must be 64bit");
 
-	arg1.v.reg ^= R_64; // no rex required for call
+		arg1.v.reg ^= R_64; // no rex required for call
 
-	compute_rexmodrmsib(&rex, &modrm, &sib, &arg2, &arg1);
+		compute_rexmodrmsib(&rex, &modrm, &sib, &arg2, &arg1);
 
-	modrm |= 0x2 << 3;
+		modrm |= 0x2 << 3;
 
-	if(rex) emit1(rex);
-	emit1(0xff);
-	emit1(modrm);
+		if(rex) emit1(rex);
+		emit1(0xff);
+		emit1(modrm);
+	}
+	else 
+	{
+		if(!isu32(arg1.v.imm))
+			crap("must be 32bit argument");
+		emit1(0xe8);
+		emit4(arg1.v.imm);
+	}
 }
 
 



More information about the quake3-commits mailing list