From 2cee0669299cd2b980aa9ae253c24107a4813b26 Mon Sep 17 00:00:00 2001 From: Bin Lu Date: Thu, 26 Sep 2019 06:09:32 +0000 Subject: enable ring0 to support arm64 This patch enabled the basic framework for arm64 guest. Serveral jobs were finished in this patch: 1, ring0.Vectors() 2, switchToUser() 3, basic framwork for Arm64 guest. Signed-off-by: Bin Lu --- pkg/sentry/platform/ring0/BUILD | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'pkg/sentry/platform/ring0/BUILD') diff --git a/pkg/sentry/platform/ring0/BUILD b/pkg/sentry/platform/ring0/BUILD index 8ed6c7652..939a0033a 100644 --- a/pkg/sentry/platform/ring0/BUILD +++ b/pkg/sentry/platform/ring0/BUILD @@ -1,17 +1,16 @@ load("//tools/go_stateify:defs.bzl", "go_library") +load("//tools/go_generics:defs.bzl", "go_template", "go_template_instance") package(licenses = ["notice"]) -load("//tools/go_generics:defs.bzl", "go_template", "go_template_instance") - go_template( name = "defs", - srcs = [ - "defs.go", - "defs_amd64.go", - "offsets_amd64.go", - "x86.go", - ], + srcs = select( + { + "@bazel_tools//src/conditions:linux_aarch64": ["defs.go", "defs_arm64.go", "offsets_arm64.go", "aarch64.go",], + "//conditions:default": ["defs.go", "defs_amd64.go", "offsets_amd64.go", "x86.go",], + }, + ), visibility = [":__subpackages__"], ) @@ -23,10 +22,15 @@ go_template_instance( ) genrule( - name = "entry_impl_amd64", - srcs = ["entry_amd64.s"], - outs = ["entry_impl_amd64.s"], - cmd = "(echo -e '// build +amd64\\n' && $(location //pkg/sentry/platform/ring0/gen_offsets) && cat $(SRCS)) > $@", + name = "entry_impl", + srcs = ["entry_amd64.s", "entry_arm64.s"], + outs = ["entry_impl.s"], + cmd = select( + { + "@bazel_tools//src/conditions:linux_aarch64": "(echo -e '// build +arm64\\n' && $(location //pkg/sentry/platform/ring0/gen_offsets) && cat $(location entry_arm64.s)) > $@", + "//conditions:default": "(echo -e '// build +amd64\\n' && $(location //pkg/sentry/platform/ring0/gen_offsets) && cat $(location entry_amd64.s)) > $@", + }, + ), tools = ["//pkg/sentry/platform/ring0/gen_offsets"], ) @@ -35,12 +39,15 @@ go_library( srcs = [ "defs_impl.go", "entry_amd64.go", - "entry_impl_amd64.s", + "entry_arm64.go", + "entry_impl.s", "kernel.go", "kernel_amd64.go", + "kernel_arm64.go", "kernel_unsafe.go", "lib_amd64.go", "lib_amd64.s", + "lib_arm64.go", "ring0.go", ], importpath = "gvisor.dev/gvisor/pkg/sentry/platform/ring0", -- cgit v1.2.3