summaryrefslogtreecommitdiffhomepage
path: root/pkg/ring0/lib_amd64.s
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@gmail.com>2021-03-30 21:40:07 -0700
committerAndrei Vagin <avagin@gmail.com>2021-04-01 13:28:15 -0700
commiteb9b8e53a3ef7bb96dcb59a0121fa9ed22f01bfd (patch)
treed01a7b7aae854e5b2a89c156d809e1b6aafc4640 /pkg/ring0/lib_amd64.s
parent6c10c772e46ffe8d27cffe77aed24f0d334d611c (diff)
platform/kvm/x86: restore mxcsr when switching from guest to sentry
Goruntime sets mxcsr once and never changes it. Reported-by: syzbot+ec55cea6e57ec083b7a6@syzkaller.appspotmail.com Fixes: #5754
Diffstat (limited to 'pkg/ring0/lib_amd64.s')
-rw-r--r--pkg/ring0/lib_amd64.s12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/ring0/lib_amd64.s b/pkg/ring0/lib_amd64.s
index 2fe83568a..70a43e79e 100644
--- a/pkg/ring0/lib_amd64.s
+++ b/pkg/ring0/lib_amd64.s
@@ -198,3 +198,15 @@ TEXT ·rdmsr(SB),NOSPLIT,$0-16
MOVL AX, ret+8(FP)
MOVL DX, ret+12(FP)
RET
+
+// stmxcsr reads the MXCSR control and status register.
+TEXT ·stmxcsr(SB),NOSPLIT,$0-8
+ MOVQ addr+0(FP), SI
+ STMXCSR (SI)
+ RET
+
+// ldmxcsr writes to the MXCSR control and status register.
+TEXT ·ldmxcsr(SB),NOSPLIT,$0-8
+ MOVQ addr+0(FP), SI
+ LDMXCSR (SI)
+ RET