summaryrefslogtreecommitdiff
path: root/src/pal
diff options
context:
space:
mode:
authorSteve MacLean <Steve.MacLean@microsoft.com>2019-07-17 13:28:11 -0400
committerSteve MacLean <Steve.MacLean@Microsoft.com>2019-07-18 15:04:13 -0400
commit9f21318b107dc5122703191246863eaa1ac0a5cf (patch)
tree746110fbe287cdab50cc13aca7a61a5e25745086 /src/pal
parent10f677611992fe2a998995f4e0cafd41f610a110 (diff)
downloadcoreclr-9f21318b107dc5122703191246863eaa1ac0a5cf.tar.gz
coreclr-9f21318b107dc5122703191246863eaa1ac0a5cf.tar.bz2
coreclr-9f21318b107dc5122703191246863eaa1ac0a5cf.zip
Arm64 Fix Rtl*Context (#25745)
Fix issues related to save restore of FPCR/FPSR/V0/V31 There were several bugs in the assembly causing FPCR/FPSR to overwrite V0 on RtlCaptureContext. Then restore from V0 on RtlRestoreContext
Diffstat (limited to 'src/pal')
-rw-r--r--src/pal/src/arch/arm64/asmconstants.h4
-rw-r--r--src/pal/src/arch/arm64/context2.S6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/pal/src/arch/arm64/asmconstants.h b/src/pal/src/arch/arm64/asmconstants.h
index b2bf74461f..08502ed3b3 100644
--- a/src/pal/src/arch/arm64/asmconstants.h
+++ b/src/pal/src/arch/arm64/asmconstants.h
@@ -88,8 +88,8 @@
#define CONTEXT_V29 CONTEXT_V28+16
#define CONTEXT_V30 CONTEXT_V29+16
#define CONTEXT_V31 CONTEXT_V30+16
-#define CONTEXT_FLOAT_CONTROL_OFFSET CONTEXT_V31
+#define CONTEXT_FLOAT_CONTROL_OFFSET CONTEXT_V31+16
#define CONTEXT_Fpcr 0
-#define CONTEXT_Fpsr CONTEXT_Fpcr+4
+#define CONTEXT_Fpsr CONTEXT_Fpcr+8
#endif
diff --git a/src/pal/src/arch/arm64/context2.S b/src/pal/src/arch/arm64/context2.S
index 64a19c9df6..7b165c2314 100644
--- a/src/pal/src/arch/arm64/context2.S
+++ b/src/pal/src/arch/arm64/context2.S
@@ -99,9 +99,8 @@ LOCAL_LABEL(Done_CONTEXT_INTEGER):
add x0, x0, CONTEXT_FLOAT_CONTROL_OFFSET
mrs x1, fpcr
mrs x2, fpsr
- sub x0, x0, CONTEXT_FLOAT_CONTROL_OFFSET
stp x1, x2, [x0, CONTEXT_Fpcr]
- sub x0, x0, CONTEXT_NEON_OFFSET
+ sub x0, x0, CONTEXT_FLOAT_CONTROL_OFFSET + CONTEXT_NEON_OFFSET
LOCAL_LABEL(Done_CONTEXT_FLOATING_POINT):
@@ -173,10 +172,11 @@ LOCAL_LABEL(Restore_CONTEXT_FLOATING_POINT):
ldp q26, q27, [x16, CONTEXT_V26]
ldp q28, q29, [x16, CONTEXT_V28]
ldp q30, q31, [x16, CONTEXT_V30]
+ add x16, x16, CONTEXT_FLOAT_CONTROL_OFFSET
ldp x1, x2, [x16, CONTEXT_Fpcr]
msr fpcr, x1
msr fpsr, x2
- sub x16, x16, CONTEXT_NEON_OFFSET
+ sub x16, x16, CONTEXT_FLOAT_CONTROL_OFFSET + CONTEXT_NEON_OFFSET
LOCAL_LABEL(No_Restore_CONTEXT_FLOATING_POINT):
tbz w17, #CONTEXT_INTEGER_BIT, LOCAL_LABEL(No_Restore_CONTEXT_INTEGER)