summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/platform/ring0/BUILD
blob: 939a0033a889ac9f52ac74b8975fc1ecf69fc834 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
load("//tools/go_stateify:defs.bzl", "go_library")
load("//tools/go_generics:defs.bzl", "go_template", "go_template_instance")

package(licenses = ["notice"])

go_template(
    name = "defs",
    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__"],
)

go_template_instance(
    name = "defs_impl",
    out = "defs_impl.go",
    package = "ring0",
    template = ":defs",
)

genrule(
    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"],
)

go_library(
    name = "ring0",
    srcs = [
        "defs_impl.go",
        "entry_amd64.go",
        "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",
    visibility = ["//pkg/sentry:internal"],
    deps = [
        "//pkg/cpuid",
        "//pkg/sentry/platform/ring0/pagetables",
        "//pkg/sentry/usermem",
    ],
)