mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
This is the first of two rather big changes to clean up includes throughout the project. In this commit, the implicit semi-dependency on libc that bonnibel adds to every module is removed. Previously, I was sloppy with includes of libc headers and include directory order. Now, the freestanding headers from libc are split out into libc_free, and an implicit real dependency is added onto this module, unless `no_libc` is set to `True`. The full libc needs to be explicitly specified as a dependency to be used. Several things needed to change in order to do this: - Many places use `memset` or `memcpy` that cannot depend on libc. The kernel has basic implementations of them itself for this reason. Now those functions are moved into the lower-level `j6/memutils.h`, and libc merely references them. Other modules are now free to reference those functions from libj6 instead. - The kernel's `assert.h` was renamed kassert.h (matching its `kassert` function) so that the new `util/assert.h` can use `__has_include` to detect it and make sure the `assert` macro is usable in libutil code. - Several implementation header files under `__libj6/` also moved under the new libc_free. - A new `include_phase` property has been added to modules for Bonnibel, which can be "normal" (default) or "late" which uses `-idirafter` instead of `-I` for includes. - Since `<utility>` and `<new>` are not freestanding, implementations of `remove_reference`, `forward`, `move`, and `swap` were added to the `util` namespace to replace those from `std`, and `util/new.h` was added to declare `operator new` and `operator delete`.
89 lines
2.2 KiB
Python
89 lines
2.2 KiB
Python
# vim: ft=python
|
|
|
|
kernel = module("kernel",
|
|
kind = "exe",
|
|
default = True,
|
|
output = "jsix.elf",
|
|
targets = [ "kernel" ],
|
|
description = "jsix kernel",
|
|
deps = [ "util", "cpu", "bootproto", "j6" ],
|
|
ld_script = "kernel.ld",
|
|
sources = [
|
|
"apic.cpp",
|
|
"kassert.cpp",
|
|
"boot.s",
|
|
"capabilities.cpp",
|
|
"clock.cpp",
|
|
"cpprt.cpp",
|
|
"cpu.cpp",
|
|
"cpu.s",
|
|
"device_manager.cpp",
|
|
"frame_allocator.cpp",
|
|
"gdt.cpp",
|
|
"gdtidt.s",
|
|
"heap_allocator.cpp",
|
|
"hpet.cpp",
|
|
"idt.cpp",
|
|
"interrupts.cpp",
|
|
"interrupts.s",
|
|
"io.cpp",
|
|
"kernel_main.cpp",
|
|
"logger.cpp",
|
|
"memory.cpp",
|
|
"memory.h.cog",
|
|
"memory_bootstrap.cpp",
|
|
"msr.cpp",
|
|
"objects/event.cpp",
|
|
"objects/kobject.cpp",
|
|
"objects/mailbox.cpp",
|
|
"objects/thread.cpp",
|
|
"objects/process.cpp",
|
|
"objects/system.cpp",
|
|
"objects/vm_area.cpp",
|
|
"page_table.cpp",
|
|
"page_tree.cpp",
|
|
"scheduler.cpp",
|
|
"smp.cpp",
|
|
"smp.s",
|
|
"syscall.cpp.cog",
|
|
"syscall.h.cog",
|
|
"syscall.s",
|
|
"syscall_verify.cpp.cog",
|
|
"syscalls.inc.cog",
|
|
"syscalls/event.cpp",
|
|
"syscalls/handle.cpp",
|
|
"syscalls/mailbox.cpp",
|
|
"syscalls/object.cpp",
|
|
"syscalls/process.cpp",
|
|
"syscalls/futex.cpp",
|
|
"syscalls/system.cpp",
|
|
"syscalls/thread.cpp",
|
|
"syscalls/vm_area.cpp",
|
|
"sysconf.cpp",
|
|
"sysconf.h.cog",
|
|
"task.s",
|
|
"tss.cpp",
|
|
"vm_space.cpp",
|
|
"wait_queue.cpp",
|
|
"xsave.cpp",
|
|
])
|
|
|
|
if config == "debug":
|
|
kernel.add_input("debugcon.cpp")
|
|
|
|
from glob import glob
|
|
from os.path import join
|
|
|
|
layout = join(source_root, "definitions/memory_layout.yaml")
|
|
sysconf = join(source_root, "definitions/sysconf.yaml")
|
|
definitions = glob(join(source_root, 'definitions/**/*.def'), recursive=True)
|
|
|
|
kernel.add_depends(["memory.h.cog"], [layout])
|
|
kernel.add_depends(["sysconf.h.cog"], [sysconf])
|
|
kernel.add_depends([
|
|
"syscall.cpp.cog",
|
|
"syscall.h.cog",
|
|
"syscalls.inc.cog",
|
|
"syscall_verify.cpp.cog",
|
|
], definitions)
|