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