blob: c6127fccbe22c8a4a31b76a6ebba5d158f400d55 [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("$zx/public/gn/host_tool_action.gni")
import("abigen.gni")
if (current_toolchain == default_toolchain) {
host_tool_action("generate_syscalls.abigen") {
tool = "$zx/tools/banjo:compiler"
sources = [
"$zx/system/public/zircon/syscalls.banjo",
]
outputs = [
abigen_source_file,
]
args = [
"--backend",
"Abigen",
"--output",
rebase_path(abigen_source_file, root_build_dir),
"--files",
rebase_path(sources[0], root_build_dir),
]
}
} else {
group("syscall-abi") {
visibility = [
":*",
"$zx/kernel/arch/$zircon_cpu:*",
"$zx/system/ulib/zircon:*",
"$zx/system/utest/core/bad-syscall:*",
]
public_configs = [ ":syscall-abi.config" ]
deps = [
":syscall-abi.generate",
]
}
config("syscall-abi.config") {
visibility = [ ":syscall-abi" ]
include_dirs = [ target_gen_dir ]
}
abigen("syscall-abi.generate") {
visibility = [ ":syscall-abi" ]
# TODO(mcgrathr): Rename these from <zircon/...> to <lib/syscalls/...>?
gen = [
{
args = [ "-numbers" ]
outputs = [
"$target_gen_dir/zircon/zx-syscall-numbers.h",
]
},
{
args = [ "-kernel-header" ]
outputs = [
"$target_gen_dir/zircon/syscall-definitions.h",
]
},
{
args = [ "-kernel-wrappers" ]
outputs = [
"$target_gen_dir/zircon/syscall-kernel-wrappers.inc",
]
},
{
args = [ "-kernel-branch" ]
outputs = [
"$target_gen_dir/zircon/syscall-kernel-branches.S",
]
},
{
args = [ "-json" ]
outputs = [
"$target_gen_dir/zircon/definitions.json",
]
},
]
}
}
if (is_kernel) {
source_set("syscalls") {
sources = [
"channel.cc",
"ddk.cc",
"ddk_${zircon_cpu}.cc",
"ddk_pci.cc",
"debug.cc",
"exceptions.cc",
"fifo.cc",
"futex.cc",
"handle_ops.cc",
"hypervisor.cc",
"object.cc",
"object_wait.cc",
"pager.cc",
"port.cc",
"profile.cc",
"resource.cc",
"socket.cc",
"system.cc",
"system_${zircon_cpu}.cc",
"task.cc",
"test.cc",
"timer.cc",
"vmar.cc",
"vmo.cc",
"zircon.cc",
]
deps = [
":dispatch",
":syscall-abi",
"$zx/kernel/dev/udisplay",
"$zx/kernel/lib/cmdline",
"$zx/kernel/lib/console",
"$zx/kernel/lib/counters",
"$zx/kernel/lib/crypto",
"$zx/kernel/lib/fbl",
"$zx/kernel/lib/gfxconsole",
"$zx/kernel/lib/ktrace",
"$zx/kernel/lib/mtrace",
"$zx/kernel/lib/pci",
"$zx/kernel/lib/user_copy",
"$zx/kernel/lib/userabi:headers",
"$zx/kernel/object",
"$zx/system/ulib/explicit-memory",
"$zx/system/ulib/libzbi",
"$zx/system/ulib/region-alloc",
]
if (current_cpu == "x64") {
deps += [ "$zx/kernel/platform/pc" ]
}
}
# Only this file depends on vdso-valid-sysret.h.
source_set("dispatch") {
sources = [
"syscalls.cc",
]
deps = [
":syscall-abi",
"$zx/kernel/lib/userabi:headers",
]
}
}