diff options
author | Andrei Vagin <avagin@gmail.com> | 2021-03-16 09:15:03 -0700 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2021-03-16 21:55:20 -0700 |
commit | 2f3dac78ca9aa1abb9d27570bc9ece0f486ddb60 (patch) | |
tree | 195f9161e491c3f31ac6a1191e651f25f9743976 /pkg/ring0/kernel_arm64.go | |
parent | f7e841c2cede357c4cbd6117605e3f3d54f1961c (diff) |
kvm: prefault a floating point state before restoring it
If physical pages of a memory region are not mapped yet, the kernel will
trigger KVM_EXIT_MMIO and we will map physical pages in bluepillHandler().
An instruction that triggered a fault will not be re-executed, it
will be emulated in the kernel, but it can't emulate complex
instructions like xsave, xrstor. We can touch the memory with
simple instructions to workaround this problem.
Diffstat (limited to 'pkg/ring0/kernel_arm64.go')
-rw-r--r-- | pkg/ring0/kernel_arm64.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/ring0/kernel_arm64.go b/pkg/ring0/kernel_arm64.go index 41909b3a0..c9a120952 100644 --- a/pkg/ring0/kernel_arm64.go +++ b/pkg/ring0/kernel_arm64.go @@ -62,7 +62,7 @@ func IsCanonical(addr uint64) bool { //go:nosplit func (c *CPU) SwitchToUser(switchOpts SwitchOpts) (vector Vector) { storeAppASID(uintptr(switchOpts.UserASID)) - storeEl0Fpstate(switchOpts.FloatingPointState) + storeEl0Fpstate(&switchOpts.FloatingPointState[0]) if switchOpts.Flush { FlushTlbByASID(uintptr(switchOpts.UserASID)) @@ -82,7 +82,7 @@ func (c *CPU) SwitchToUser(switchOpts SwitchOpts) (vector Vector) { fpDisableTrap = CPACREL1() if fpDisableTrap != 0 { - SaveFloatingPoint(switchOpts.FloatingPointState) + SaveFloatingPoint(&switchOpts.FloatingPointState[0]) } vector = c.vecCode |