gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/pkg/ring0/pagetables/BUILD (about)

     1  load("//tools:defs.bzl", "go_library", "go_test")
     2  load("//tools/go_generics:defs.bzl", "go_template", "go_template_instance")
     3  
     4  package(
     5      default_applicable_licenses = ["//:license"],
     6      licenses = ["notice"],
     7  )
     8  
     9  [
    10      # These files are tagged with relevant build architectures. We can always
    11      # build all the input files, which will be included only in the relevant
    12      # architecture builds.
    13      go_template(
    14          name = "generic_walker_%s" % arch,
    15          srcs = [
    16              "walker_generic.go",
    17              "walker_%s.go" % arch,
    18          ],
    19          opt_types = [
    20              "Visitor",
    21          ],
    22          visibility = [":__pkg__"],
    23      )
    24      for arch in ("amd64", "arm64")
    25  ]
    26  
    27  [
    28      # See above.
    29      go_template_instance(
    30          name = "walker_%s_%s" % (op, arch),
    31          out = "walker_%s_%s.go" % (op, arch),
    32          package = "pagetables",
    33          prefix = op,
    34          template = ":generic_walker_%s" % arch,
    35          types = {
    36              "Visitor": "%sVisitor" % op,
    37          },
    38      )
    39      for op in ("map", "unmap", "lookup", "empty", "check")
    40      for arch in ("amd64", "arm64")
    41  ]
    42  
    43  go_library(
    44      name = "pagetables",
    45      srcs = [
    46          "allocator.go",
    47          "allocator_unsafe.go",
    48          "pagetables.go",
    49          "pagetables_aarch64.go",
    50          "pagetables_amd64.go",
    51          "pagetables_arm64.go",
    52          "pagetables_x86.go",
    53          "pcids.go",
    54          "pcids_aarch64.go",
    55          "pcids_aarch64.s",
    56          "pcids_x86.go",
    57          "walker_amd64.go",
    58          "walker_arm64.go",
    59          "walker_generic.go",
    60          ":walker_empty_amd64",
    61          ":walker_empty_arm64",
    62          ":walker_lookup_amd64",
    63          ":walker_lookup_arm64",
    64          ":walker_map_amd64",
    65          ":walker_map_arm64",
    66          ":walker_unmap_amd64",
    67          ":walker_unmap_arm64",
    68      ],
    69      visibility = [
    70          "//pkg/ring0:__subpackages__",
    71          "//pkg/sentry/platform/kvm:__subpackages__",
    72      ],
    73      deps = [
    74          "//pkg/hostarch",
    75          "//pkg/sync",
    76      ],
    77  )
    78  
    79  go_test(
    80      name = "pagetables_test",
    81      size = "small",
    82      srcs = [
    83          "pagetables_amd64_test.go",
    84          "pagetables_arm64_test.go",
    85          "pagetables_test.go",
    86          ":walker_check_amd64",
    87          ":walker_check_arm64",
    88      ],
    89      library = ":pagetables",
    90      deps = ["//pkg/hostarch"],
    91  )