summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/platform/kvm/kvm_amd64.go
diff options
context:
space:
mode:
authorlubinszARM <34124929+lubinszARM@users.noreply.github.com>2019-12-13 17:09:55 -0800
committergVisor bot <gvisor-bot@google.com>2019-12-13 17:11:23 -0800
commit6b424530397e5100b08628efe8f6c62178daa70b (patch)
tree86e0334547d5a5395b81680435cd5feecf36c76e /pkg/sentry/platform/kvm/kvm_amd64.go
parentad80dcf47077a1938631fe36f6b406256f3f3f4f (diff)
enable kvm to support arm64
There are 4 jobs were finished in this package: 1, Virtual machine initialization. 2, Bluepill implementation. 3, Move ring0.Vectors() into the address with 11-bits alignment. 4, Basic support for "SwitchToUser". Signed-off-by: Bin Lu <bin.lu@arm.com> COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/919 from lubinszARM:pr_kvm eedea52db451bf62722759009a9f14c54a69c55f PiperOrigin-RevId: 285501256
Diffstat (limited to 'pkg/sentry/platform/kvm/kvm_amd64.go')
-rw-r--r--pkg/sentry/platform/kvm/kvm_amd64.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/sentry/platform/kvm/kvm_amd64.go b/pkg/sentry/platform/kvm/kvm_amd64.go
index 5d8ef4761..c5a6f9c7d 100644
--- a/pkg/sentry/platform/kvm/kvm_amd64.go
+++ b/pkg/sentry/platform/kvm/kvm_amd64.go
@@ -17,6 +17,7 @@
package kvm
import (
+ "gvisor.dev/gvisor/pkg/cpuid"
"gvisor.dev/gvisor/pkg/sentry/platform/ring0"
)
@@ -211,3 +212,11 @@ type cpuidEntries struct {
_ uint32
entries [_KVM_NR_CPUID_ENTRIES]cpuidEntry
}
+
+// updateGlobalOnce does global initialization. It has to be called only once.
+func updateGlobalOnce(fd int) error {
+ physicalInit()
+ err := updateSystemValues(int(fd))
+ ring0.Init(cpuid.HostFeatureSet())
+ return err
+}