This is the mail archive of the frysk@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] fix returnCode in LinuxPPC64.java


On ppc64, the gpr3 is used to store the return code of a system call. But its value is unsigned. Another register, CCR, is used to indicate the return code is negative or not. Current code of LinuxPPC64.java doesn't know that. This patch will fix that. It can also fix the failure of testSyscallOpen (http://sources.redhat.com/bugzilla/show_bug.cgi?id=3011). Tested on PPC64, OK to commit?

Regards
- Wu Zhou
2006-08-08  Wu Zhou  <woodzltc@cn.ibm.com>

	* LinuxPPC64.java (returnCode): When the 29th bit of register CCR is
	set, return the negation of register GPR3.

--- frysk-core/frysk/proc/LinuxPPC64.java.old	2006-08-08 18:07:37.000000000 +0800
+++ frysk-core/frysk/proc/LinuxPPC64.java	2006-08-08 18:06:08.000000000 +0800
@@ -33,7 +33,11 @@
 	}
 	public long returnCode (Task task)
         {
-          return getRegisterByName("gpr3").get(task);
+          int flag =  (int)getRegisterByName("ccr").get(task);
+          if ((flag & 0x10000000) != 0)
+            return -getRegisterByName("gpr3").get(task);
+          else
+            return getRegisterByName("gpr3").get(task);
 	}
 	public long arg (Task task, int n)
 	{

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]