2023-05-17 20:20:53 -07:00
|
|
|
add_executable(zion
|
2023-06-07 16:24:13 -07:00
|
|
|
boot/acpi.cpp
|
2023-05-18 01:16:53 -07:00
|
|
|
boot/boot_info.cpp
|
2023-06-16 14:25:45 -07:00
|
|
|
capability/capability_table.cpp
|
2023-11-20 16:40:07 -08:00
|
|
|
common/cpu.cpp
|
2023-05-17 21:41:08 -07:00
|
|
|
common/gdt.cpp
|
|
|
|
common/load_gdt.s
|
2023-06-07 13:40:36 -07:00
|
|
|
common/msr.cpp
|
2023-11-22 18:25:08 -08:00
|
|
|
common/stack_unwind.cpp
|
2023-05-17 20:42:59 -07:00
|
|
|
debug/debug.cpp
|
2023-06-07 13:40:36 -07:00
|
|
|
interrupt/apic.cpp
|
2023-08-01 20:18:47 -07:00
|
|
|
interrupt/apic_timer.cpp
|
2023-11-25 11:13:25 -08:00
|
|
|
interrupt/driver_manager.cpp
|
2023-05-17 22:54:37 -07:00
|
|
|
interrupt/interrupt.cpp
|
|
|
|
interrupt/interrupt_enter.s
|
2023-05-29 21:52:01 -07:00
|
|
|
interrupt/timer.cpp
|
2023-11-19 18:55:44 -08:00
|
|
|
lib/memory_mapping_tree.cpp
|
2023-06-20 15:29:32 -07:00
|
|
|
lib/message_queue.cpp
|
2023-05-29 00:32:54 -07:00
|
|
|
loader/init_loader.cpp
|
2023-05-18 09:46:41 -07:00
|
|
|
memory/kernel_heap.cpp
|
2023-05-30 21:27:20 -07:00
|
|
|
memory/kernel_stack_manager.cpp
|
2023-11-15 15:14:29 -08:00
|
|
|
memory/kernel_vmm.cpp
|
2023-05-18 01:18:51 -07:00
|
|
|
memory/paging_util.cpp
|
2023-05-18 11:00:05 -07:00
|
|
|
memory/physical_memory.cpp
|
2023-11-15 12:03:42 -08:00
|
|
|
memory/slab_allocator.cpp
|
2023-05-30 22:35:57 -07:00
|
|
|
memory/user_stack_manager.cpp
|
2023-06-06 21:44:10 -07:00
|
|
|
object/address_space.cpp
|
2023-06-07 08:24:10 -07:00
|
|
|
object/channel.cpp
|
2023-06-21 23:14:42 -07:00
|
|
|
object/endpoint.cpp
|
2023-06-21 23:42:21 -07:00
|
|
|
object/ipc_object.cpp
|
2023-06-06 21:44:10 -07:00
|
|
|
object/memory_object.cpp
|
2023-10-25 14:47:45 -07:00
|
|
|
object/mutex.cpp
|
2023-06-12 19:20:51 -07:00
|
|
|
object/port.cpp
|
2023-06-06 20:18:53 -07:00
|
|
|
object/process.cpp
|
2023-06-21 23:14:42 -07:00
|
|
|
object/reply_port.cpp
|
2023-11-22 10:19:56 -08:00
|
|
|
object/semaphore.cpp
|
2023-06-06 20:18:53 -07:00
|
|
|
object/thread.cpp
|
2023-11-24 15:04:03 -08:00
|
|
|
scheduler/cleanup.cpp
|
2023-05-18 13:24:02 -07:00
|
|
|
scheduler/context_switch.s
|
2023-05-29 12:44:26 -07:00
|
|
|
scheduler/jump_user_space.s
|
2023-05-29 23:35:44 -07:00
|
|
|
scheduler/process_manager.cpp
|
2023-05-18 12:43:53 -07:00
|
|
|
scheduler/scheduler.cpp
|
2023-06-20 14:26:06 -07:00
|
|
|
syscall/address_space.cpp
|
2023-06-20 15:03:33 -07:00
|
|
|
syscall/capability.cpp
|
|
|
|
syscall/debug.cpp
|
2023-06-21 23:20:56 -07:00
|
|
|
syscall/ipc.cpp
|
2023-06-20 14:26:06 -07:00
|
|
|
syscall/memory_object.cpp
|
2023-06-20 14:01:43 -07:00
|
|
|
syscall/process.cpp
|
2023-10-25 14:47:45 -07:00
|
|
|
syscall/synchronization.cpp
|
2023-05-18 16:03:09 -07:00
|
|
|
syscall/syscall.cpp
|
|
|
|
syscall/syscall_enter.s
|
2023-06-20 14:26:06 -07:00
|
|
|
syscall/thread.cpp
|
2023-05-17 20:20:53 -07:00
|
|
|
zion.cpp)
|
|
|
|
|
2023-05-17 20:42:59 -07:00
|
|
|
target_include_directories(zion
|
|
|
|
PRIVATE
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
|
2023-06-21 14:42:37 -07:00
|
|
|
target_link_libraries(zion
|
2023-11-05 09:24:09 -08:00
|
|
|
glacier_kernel)
|
2023-06-21 14:42:37 -07:00
|
|
|
|
2023-05-17 21:41:08 -07:00
|
|
|
# -c -- Don't run the linker (only necessary for the assembler)
|
|
|
|
# -ffreestanding
|
2023-05-18 11:29:44 -07:00
|
|
|
# -fno-rtti -- No runtime type information (might mess with polymorphism?)
|
|
|
|
# -fno-exceptions -- Disable exceptions.
|
2023-05-17 20:20:53 -07:00
|
|
|
# -nostdlib -- Don't include the standard library.
|
|
|
|
# -mabi=sysv -- Explicitly specify the ABI since we will rely on it.
|
|
|
|
# -mno-red-zone -- Don't put data below the stack pointer (clobbered by interrupts).
|
|
|
|
# -mcmodel=kernel -- Assume the kernel code is running in the higher half.
|
|
|
|
# -mgeneral-regs-only -- Prevent GCC from using a whole host of nonsense registers (that we have to enable).
|
2023-11-19 20:33:15 -08:00
|
|
|
set(_Z_COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -c -ffreestanding -fno-rtti -fno-exceptions -fno-use-cxa-atexit -nostdlib -mabi=sysv -mno-red-zone -mcmodel=kernel -mgeneral-regs-only")
|
2023-05-17 20:20:53 -07:00
|
|
|
|
|
|
|
set(_Z_LINK_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linker.ld")
|
|
|
|
|
|
|
|
# -lgcc -- Link against gcc internals. Not sure if necessary.
|
|
|
|
# -nostdlib -- Don't try to link against the stdlib.
|
|
|
|
# -nostartfiles -- Don't try to link against crt0.s
|
|
|
|
# -static -- Prevent trying something with shared libraries (probably irrelevant).
|
|
|
|
# -z max-page-size=0x1000 -- Assume 4 KiB Pages.
|
|
|
|
set(_Z_LINK_FLAGS "-T ${_Z_LINK_SCRIPT} -lgcc -nostdlib -nostartfiles -static -z max-page-size=0x1000")
|
|
|
|
|
|
|
|
|
|
|
|
# Don't try to dynamically link.
|
|
|
|
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
|
|
|
|
|
|
|
set_target_properties(zion
|
|
|
|
PROPERTIES
|
|
|
|
COMPILE_FLAGS "${_Z_COMPILE_FLAGS}"
|
|
|
|
LINK_FLAGS "${_Z_LINK_FLAGS}"
|
|
|
|
)
|
2023-05-29 00:32:54 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-26 11:57:19 -07:00
|
|
|
add_library(zion_stub STATIC
|
2023-05-29 00:32:54 -07:00
|
|
|
usr/crt0.s
|
|
|
|
usr/zcall.cpp)
|
|
|
|
|
2023-06-26 11:57:19 -07:00
|
|
|
target_include_directories(zion_stub
|
2023-05-29 00:32:54 -07:00
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
|
2023-06-26 11:57:19 -07:00
|
|
|
set_target_properties(zion_stub
|
2023-05-29 00:32:54 -07:00
|
|
|
PROPERTIES
|
|
|
|
COMPILE_FLAGS "${_Z_COMPILE_FLAGS}")
|