summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2015-10-29 22:12:03 +0000
committergonzo <gonzo@FreeBSD.org>2015-10-29 22:12:03 +0000
commitcaa2a6f36aa221602162cf3c48c71b51f3b3b2dd (patch)
tree570438c15f4b98ddded8fdebc0770cea96d5998d /sys/arm
parent9278a0880b0cf18e808f99a2a582b3a2f6971a7b (diff)
downloadFreeBSD-src-caa2a6f36aa221602162cf3c48c71b51f3b3b2dd.zip
FreeBSD-src-caa2a6f36aa221602162cf3c48c71b51f3b3b2dd.tar.gz
Fix LEAVE_HYP macro: spsr is not guaranteed to contain valid value at this
point, e.g. on RaspberryPi 2 when control is passed from loader to kernel it contains garbage. So we use cpsr as a base for new cpsr value: if we have reached this point it means current value is OK Reviewed by: andrew
Diffstat (limited to 'sys/arm')
-rw-r--r--sys/arm/arm/locore-v6.S6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/arm/arm/locore-v6.S b/sys/arm/arm/locore-v6.S
index 5a52228..6aa61f3 100644
--- a/sys/arm/arm/locore-v6.S
+++ b/sys/arm/arm/locore-v6.S
@@ -74,9 +74,11 @@ __FBSDID("$FreeBSD$");
teq r0, #(PSR_HYP32_MODE) /* Hyp Mode? */ ;\
bne 1f ;\
/* Ensure that IRQ, FIQ and Aborts will be disabled after eret */ ;\
- mrs r0, spsr ;\
+ mrs r0, cpsr ;\
+ bic r0, r0, #(PSR_MODE) ;\
+ orr r0, r0, #(PSR_SVC32_MODE) ;\
orr r0, r0, #(PSR_I | PSR_F | PSR_A) ;\
- msr spsr, r0 ;\
+ msr spsr_cxsf, r0 ;\
/* Exit hypervisor mode */ ;\
adr lr, 1f ;\
MSR_ELR_HYP(14) ;\
OpenPOWER on IntegriCloud