github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/pkg/ring0/BUILD (about) 1 load("//tools:defs.bzl", "arch_genrule", "go_library") 2 load("//tools/go_generics:defs.bzl", "go_template", "go_template_instance") 3 4 package(licenses = ["notice"]) 5 6 go_template( 7 name = "defs_amd64", 8 srcs = [ 9 "defs.go", 10 "defs_amd64.go", 11 "offsets_amd64.go", 12 "x86.go", 13 ], 14 visibility = [":__subpackages__"], 15 ) 16 17 go_template( 18 name = "defs_arm64", 19 srcs = [ 20 "aarch64.go", 21 "defs.go", 22 "defs_arm64.go", 23 "offsets_arm64.go", 24 ], 25 visibility = [":__subpackages__"], 26 ) 27 28 go_template_instance( 29 name = "defs_impl_amd64", 30 out = "defs_impl_amd64.go", 31 package = "ring0", 32 template = ":defs_amd64", 33 ) 34 35 go_template_instance( 36 name = "defs_impl_arm64", 37 out = "defs_impl_arm64.go", 38 package = "ring0", 39 template = ":defs_arm64", 40 ) 41 42 arch_genrule( 43 name = "entry_impl_amd64", 44 srcs = ["entry_amd64.s"], 45 outs = ["entry_impl_amd64.s"], 46 cmd = "(echo -e '// build +amd64\\n' && QEMU $(location //pkg/ring0/gen_offsets) && cat $(location entry_amd64.s)) > $@", 47 tools = ["//pkg/ring0/gen_offsets"], 48 ) 49 50 arch_genrule( 51 name = "entry_impl_arm64", 52 srcs = ["entry_arm64.s"], 53 outs = ["entry_impl_arm64.s"], 54 cmd = "(echo -e '// build +arm64\\n' && QEMU $(location //pkg/ring0/gen_offsets) && cat $(location entry_arm64.s)) > $@", 55 tools = ["//pkg/ring0/gen_offsets"], 56 ) 57 58 go_library( 59 name = "ring0", 60 srcs = [ 61 "defs_impl_amd64.go", 62 "defs_impl_arm64.go", 63 "entry_amd64.go", 64 "entry_arm64.go", 65 "entry_impl_amd64.s", 66 "entry_impl_arm64.s", 67 "kernel.go", 68 "kernel_amd64.go", 69 "kernel_arm64.go", 70 "kernel_unsafe.go", 71 "lib_amd64.go", 72 "lib_amd64.s", 73 "lib_arm64.go", 74 "lib_arm64.s", 75 "ring0.go", 76 ], 77 visibility = ["//pkg/sentry:internal"], 78 deps = [ 79 "//pkg/cpuid", 80 "//pkg/hostarch", 81 "//pkg/ring0/pagetables", 82 "//pkg/safecopy", 83 "//pkg/sentry/arch", 84 "//pkg/sentry/arch/fpu", 85 ], 86 )