diff options
author | 2017-02-03 10:46:19 +0000 | |
---|---|---|
committer | 2017-02-03 10:46:19 +0000 | |
commit | b7363c1ff3ca7338ca67af3639923f50475c0938 (patch) | |
tree | 807d75dc1cae9a10358eaa0bfb3ea07078823e6a | |
parent | Use PAGE_SHIFT instead of encoding the number. (diff) | |
download | wireguard-openbsd-b7363c1ff3ca7338ca67af3639923f50475c0938.tar.xz wireguard-openbsd-b7363c1ff3ca7338ca67af3639923f50475c0938.zip |
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.S | 12 |
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 |