summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/platform/kvm/BUILD
blob: d902e344a4c5de89a877ae363afcf71b6eb91d63 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package(licenses = ["notice"])  # Apache 2.0

load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("//tools/go_generics:defs.bzl", "go_template_instance")

go_template_instance(
    name = "host_map_set",
    out = "host_map_set.go",
    consts = {
        "minDegree": "15",
    },
    imports = {
        "usermem": "gvisor.googlesource.com/gvisor/pkg/sentry/usermem",
    },
    package = "kvm",
    prefix = "hostMap",
    template = "//pkg/segment:generic_set",
    types = {
        "Key": "usermem.Addr",
        "Range": "usermem.AddrRange",
        "Value": "uintptr",
        "Functions": "hostMapSetFunctions",
    },
)

go_library(
    name = "kvm",
    srcs = [
        "address_space.go",
        "bluepill.go",
        "bluepill_amd64.go",
        "bluepill_amd64.s",
        "bluepill_amd64_unsafe.go",
        "bluepill_fault.go",
        "bluepill_unsafe.go",
        "context.go",
        "host_map.go",
        "host_map_set.go",
        "kvm.go",
        "kvm_amd64.go",
        "kvm_amd64_unsafe.go",
        "kvm_const.go",
        "machine.go",
        "machine_amd64.go",
        "machine_amd64_unsafe.go",
        "machine_unsafe.go",
        "physical_map.go",
        "virtual_map.go",
    ],
    importpath = "gvisor.googlesource.com/gvisor/pkg/sentry/platform/kvm",
    visibility = ["//pkg/sentry:internal"],
    deps = [
        "//pkg/abi/linux",
        "//pkg/cpuid",
        "//pkg/log",
        "//pkg/sentry/arch",
        "//pkg/sentry/platform",
        "//pkg/sentry/platform/filemem",
        "//pkg/sentry/platform/interrupt",
        "//pkg/sentry/platform/procid",
        "//pkg/sentry/platform/ring0",
        "//pkg/sentry/platform/ring0/pagetables",
        "//pkg/sentry/platform/safecopy",
        "//pkg/sentry/time",
        "//pkg/sentry/usermem",
        "//pkg/tmutex",
    ],
)

go_test(
    name = "kvm_test",
    size = "small",
    srcs = [
        "kvm_test.go",
        "virtual_map_test.go",
    ],
    embed = [":kvm"],
    tags = [
        "nogotsan",
        "requires-kvm",
    ],
    deps = [
        "//pkg/sentry/arch",
        "//pkg/sentry/platform",
        "//pkg/sentry/platform/kvm/testutil",
        "//pkg/sentry/platform/ring0",
        "//pkg/sentry/platform/ring0/pagetables",
        "//pkg/sentry/usermem",
    ],
)