[aarch64-port-dev ] Correct setting of carry flag after subs instruction

Andrew Haley aph at redhat.com
Tue Nov 26 09:16:08 PST 2013


The carry flag is the wrong way up after a SUBS (extended register).

Fixed thusly.  Note that you must patch simulator and HotSpot.

Andrew.


# HG changeset patch
# User aph
# Date 1385485688 0
# Node ID 0bb5cbbe1dbeb042d987be41c8834aa54fe447b7
# Parent  93e88ac7ba615034ef57e058a7e768ff2dcc6135
Correct setting of carry flag after subs instruction

diff -r 93e88ac7ba61 -r 0bb5cbbe1dbe simulator.cpp
--- a/simulator.cpp	Thu Nov 21 18:22:10 2013 +0000
+++ b/simulator.cpp	Tue Nov 26 17:08:08 2013 +0000
@@ -6288,8 +6288,7 @@
   u_int32_t value2 = extreg32(16, extension) << shift;
   u_int64_t x86flags;

-  asm ("SUB %2,%0\n\tPUSHF\t\nPOP %1"  : "+r" (value), "=r" (x86flags) : "r" (value2));
-  xreg(0, NO_SP) = value;
+  xreg(0, NO_SP) = subs(value, value2, x86flags);
   cpuState.setCPSRRegisterFromX86(x86flags);
 }

@@ -6301,8 +6300,7 @@
   u_int64_t value2 = extreg(16, extension) << shift;
   u_int64_t x86flags;

-  asm ("SUB %2,%0\n\tPUSHF\t\nPOP %1"  : "+r" (value), "=r" (x86flags) : "r" (value2));
-  xreg(0, NO_SP) = value;
+  xreg(0, NO_SP) = subs(value, value2, x86flags);
   cpuState.setCPSRRegisterFromX86(x86flags);
 }

# HG changeset patch
# User aph
# Date 1385485862 0
# Node ID f33b0ad876b7bfd40d05a698af42df7035db33d3
# Parent  e9f4f09746dcd90b945525a3ed0abb9115dcca02
Fix stack overflow check.

diff -r e9f4f09746dc -r f33b0ad876b7 src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
--- a/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp	Tue Nov 26 17:09:10 2013 +0000
+++ b/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp	Tue Nov 26 17:11:02 2013 +0000
@@ -520,7 +520,7 @@

   // check against the current stack bottom
   __ cmp(sp, r0);
-  __ br(Assembler::LO, after_frame_check);
+  __ br(Assembler::HI, after_frame_check);

   // Note: the restored frame is not necessarily interpreted.
   // Use the shared runtime version of the StackOverflowError.



More information about the aarch64-port-dev mailing list