summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/platform/ring0/pagetables/BUILD
blob: 5818415552f7f5dcb2d6550da31c5d3d4e2ef484 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
load("//tools:defs.bzl", "go_library", "go_test", "select_arch")
load("//tools/go_generics:defs.bzl", "go_template", "go_template_instance")

package(licenses = ["notice"])

go_template(
    name = "generic_walker",
    srcs = select_arch(
        amd64 = ["walker_amd64.go"],
        arm64 = ["walker_arm64.go"],
    ),
    opt_types = [
        "Visitor",
    ],
    visibility = [":__pkg__"],
)

go_template_instance(
    name = "walker_map",
    out = "walker_map.go",
    package = "pagetables",
    prefix = "map",
    template = ":generic_walker",
    types = {
        "Visitor": "mapVisitor",
    },
)

go_template_instance(
    name = "walker_unmap",
    out = "walker_unmap.go",
    package = "pagetables",
    prefix = "unmap",
    template = ":generic_walker",
    types = {
        "Visitor": "unmapVisitor",
    },
)

go_template_instance(
    name = "walker_lookup",
    out = "walker_lookup.go",
    package = "pagetables",
    prefix = "lookup",
    template = ":generic_walker",
    types = {
        "Visitor": "lookupVisitor",
    },
)

go_template_instance(
    name = "walker_empty",
    out = "walker_empty.go",
    package = "pagetables",
    prefix = "empty",
    template = ":generic_walker",
    types = {
        "Visitor": "emptyVisitor",
    },
)

go_template_instance(
    name = "walker_check",
    out = "walker_check.go",
    package = "pagetables",
    prefix = "check",
    template = ":generic_walker",
    types = {
        "Visitor": "checkVisitor",
    },
)

go_library(
    name = "pagetables",
    srcs = [
        "allocator.go",
        "allocator_unsafe.go",
        "pagetables.go",
        "pagetables_aarch64.go",
        "pagetables_amd64.go",
        "pagetables_arm64.go",
        "pagetables_x86.go",
        "pcids.go",
        "walker_amd64.go",
        "walker_arm64.go",
        "walker_empty.go",
        "walker_lookup.go",
        "walker_map.go",
        "walker_unmap.go",
    ],
    visibility = [
        "//pkg/sentry/platform/kvm:__subpackages__",
        "//pkg/sentry/platform/ring0:__subpackages__",
    ],
    deps = [
        "//pkg/sync",
        "//pkg/usermem",
    ],
)

go_test(
    name = "pagetables_test",
    size = "small",
    srcs = [
        "pagetables_amd64_test.go",
        "pagetables_arm64_test.go",
        "pagetables_test.go",
        "walker_check.go",
    ],
    library = ":pagetables",
    deps = ["//pkg/usermem"],
)