| # Copyright 2019 The Fuchsia Authors |
| # |
| # Use of this source code is governed by a MIT-style |
| # license that can be found in the LICENSE file or at |
| # https://opensource.org/licenses/MIT |
| |
| import("//build/cpp/library_headers.gni") |
| import("//build/toolchain/toolchain_environment.gni") |
| import("//zircon/system/ulib/hwreg/hwreg_asm_header.gni") |
| |
| source_set("code-patching") { |
| public_deps = [ ":headers" ] |
| |
| if (toolchain_environment == "kernel.phys") { |
| sources = [ "code-patching.cc" ] |
| deps = [ "//zircon/kernel/phys:main" ] |
| } |
| } |
| |
| source_set("self-test") { |
| public = [ "include/lib/code-patching/self-test.h" ] |
| public_configs = [ ":headers.config" ] |
| sources = [ "self-test.S" ] |
| deps = [ |
| ":case-id-asm", |
| "//zircon/kernel/lib/arch", |
| ] |
| } |
| |
| library_headers("headers") { |
| headers = [ |
| "lib/code-patching/asm.h", |
| "lib/code-patching/code-patches.h", |
| "lib/code-patching/code-patching.h", |
| ] |
| |
| public_deps = [ ":case-id-asm" ] |
| |
| if (is_kernel) { |
| public_deps += [ |
| "//zircon/kernel/lib/ktl:headers", |
| |
| # code-patches.h includes <lib/arch/cache.h> |
| # code-patching.h includes <lib/arch/nop.h>. |
| "//zircon/kernel/lib/arch:headers", |
| |
| # code-patches.h includes <lib/zbitl/items/bootfs.h> |
| "//src/lib/zbitl:headers", |
| |
| # code-patches.h includes <lib/fit/result.h> |
| "//sdk/lib/fit:headers", |
| ] |
| } |
| } |
| |
| hwreg_asm_header("case-id-asm") { |
| visibility = [ ":*" ] |
| output_name = "arch/code-patches/case-id-asm.h" |
| sources = [ "gen-case-id-asm.cc" ] |
| include_dirs = [ "//zircon/kernel" ] |
| } |