summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2017-02-03 10:46:20 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2017-02-03 10:46:20 +0000
commit848681829586d1e67b7f69b169b7ec89e7e61ad9 (patch)
tree5c3b1598ebf47fef167d30c708a5d48f35102645
parent5e3bc90e0246b92c68038b567da63c4c73701df2 (diff)
Set the context id and counter offset to a known value. Enable access
to the physical timers at EL1. From FreeBSD
-rw-r--r--sys/arch/arm64/arm64/locore.S12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/arch/arm64/arm64/locore.S b/sys/arch/arm64/arm64/locore.S
index 76ab4ebba3b..c96ec895b8a 100644
--- a/sys/arch/arm64/arm64/locore.S
+++ b/sys/arch/arm64/arm64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.8 2017/02/03 10:34:21 patrick Exp $ */
+/* $OpenBSD: locore.S,v 1.9 2017/02/03 10:46:19 patrick Exp $ */
/*-
* Copyright (c) 2012-2014 Andrew Turner
* All rights reserved.
@@ -74,6 +74,8 @@ _start:
msr sctlr_el1, x2
isb
+ /* Set the context id */
+ msr contextidr_el1, xzr
/* Get the virt -> phys offset */
bl get_virt_delta
@@ -222,6 +224,14 @@ drop_to_el1:
/* Don't trap to EL2 for CP15 traps */
msr hstr_el2, xzr
+ /* Enable access to the physical timers at EL1 */
+ mrs x2, cnthctl_el2
+ orr x2, x2, #(CNTHCTL_EL1PCTEN | CNTHCTL_EL1PCEN)
+ msr cnthctl_el2, x2
+
+ /* Set the counter offset to a known value */
+ msr cntvoff_el2, xzr
+
/* Hypervisor trap functions */
adr x2, hyp_vectors
msr vbar_el2, x2