blob: 13bb9d2592ba55563212d4ba33bfe1caaf9561f7 [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("kazoo.gni")
if (current_toolchain == default_toolchain) {
host_tool_action("generate_syscalls.kazoo") {
tool = "$zx/tools/fidl:fidlc"
sources = [
"$zx/syscalls/alias_workarounds.fidl",
"$zx/syscalls/bti.fidl",
"$zx/syscalls/cache.fidl",
"$zx/syscalls/channel.fidl",
"$zx/syscalls/clock.fidl",
"$zx/syscalls/cprng.fidl",
"$zx/syscalls/debug.fidl",
"$zx/syscalls/debuglog.fidl",
"$zx/syscalls/event.fidl",
"$zx/syscalls/eventpair.fidl",
"$zx/syscalls/exception.fidl",
"$zx/syscalls/fifo.fidl",
"$zx/syscalls/framebuffer.fidl",
"$zx/syscalls/futex.fidl",
"$zx/syscalls/guest.fidl",
"$zx/syscalls/handle.fidl",
"$zx/syscalls/interrupt.fidl",
"$zx/syscalls/iommu.fidl",
"$zx/syscalls/ioports.fidl",
"$zx/syscalls/job.fidl",
"$zx/syscalls/ktrace.fidl",
"$zx/syscalls/misc.fidl",
"$zx/syscalls/mtrace.fidl",
"$zx/syscalls/object.fidl",
"$zx/syscalls/pager.fidl",
"$zx/syscalls/pc.fidl",
"$zx/syscalls/pci.fidl",
"$zx/syscalls/pmt.fidl",
"$zx/syscalls/port.fidl",
"$zx/syscalls/process.fidl",
"$zx/syscalls/profile.fidl",
"$zx/syscalls/resource.fidl",
"$zx/syscalls/rights.fidl",
"$zx/syscalls/smc.fidl",
"$zx/syscalls/socket.fidl",
"$zx/syscalls/syscall.fidl",
"$zx/syscalls/system.fidl",
"$zx/syscalls/task.fidl",
"$zx/syscalls/thread.fidl",
"$zx/syscalls/timer.fidl",
"$zx/syscalls/vcpu.fidl",
"$zx/syscalls/vmar.fidl",
"$zx/syscalls/vmo.fidl",
"$zx/syscalls/zx.fidl",
]
outputs = [
syscall_ir_json,
]
args = [
"--json",
rebase_path(syscall_ir_json, root_build_dir),
"--files",
]
foreach(fidl, sources) {
args += [ rebase_path(fidl, 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 ]
}
kazoo("syscall-abi.generate") {
visibility = [ ":syscall-abi" ]
# TODO(mcgrathr): Rename these from <zircon/...> to <lib/syscalls/...>?
gen = [
{
args = [ "--syscall-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-branches" ]
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",
"clock.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",
"priv.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",
]
}
}