summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/platform/ring0/x86.go
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2018-06-08 17:50:55 -0700
committerShentubot <shentubot@google.com>2018-06-08 17:51:50 -0700
commitc0ab059e7b904197f52ade879711d7fb02ffa8c0 (patch)
tree093689eba3e7ef08663be3d43f6c6763228ed571 /pkg/sentry/platform/ring0/x86.go
parent2fbd1cf57cb06c5f0165a2d0e9225eed242a41f5 (diff)
Fix kernel flags handling and add missing vectors.
PiperOrigin-RevId: 199877174 Change-Id: I9d19ea301608c2b989df0a6123abb1e779427853
Diffstat (limited to 'pkg/sentry/platform/ring0/x86.go')
-rw-r--r--pkg/sentry/platform/ring0/x86.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/sentry/platform/ring0/x86.go b/pkg/sentry/platform/ring0/x86.go
index 74b140066..3d437a77c 100644
--- a/pkg/sentry/platform/ring0/x86.go
+++ b/pkg/sentry/platform/ring0/x86.go
@@ -24,6 +24,7 @@ import (
const (
_CR0_PE = 1 << 0
_CR0_ET = 1 << 4
+ _CR0_AM = 1 << 18
_CR0_PG = 1 << 31
_CR4_PSE = 1 << 4
@@ -55,6 +56,20 @@ const (
_MSR_SYSCALL_MASK = 0xc0000084
)
+const (
+ // KernelFlagsSet should always be set in the kernel.
+ KernelFlagsSet = _RFLAGS_RESERVED
+
+ // UserFlagsSet are always set in userspace.
+ UserFlagsSet = _RFLAGS_RESERVED | _RFLAGS_IF
+
+ // KernelFlagsClear should always be clear in the kernel.
+ KernelFlagsClear = _RFLAGS_STEP | _RFLAGS_IF | _RFLAGS_IOPL | _RFLAGS_AC | _RFLAGS_NT
+
+ // UserFlagsClear are always cleared in userspace.
+ UserFlagsClear = _RFLAGS_NT | _RFLAGS_IOPL
+)
+
// Vector is an exception vector.
type Vector uintptr