2021-05-23 20:20:22 +00:00
|
|
|
if (ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS)
|
|
|
|
add_compile_options(-Og)
|
|
|
|
add_compile_options(-ggdb3)
|
|
|
|
else()
|
|
|
|
add_compile_options(-Os)
|
|
|
|
endif()
|
2021-02-24 10:30:19 +00:00
|
|
|
|
2021-03-04 16:50:05 +00:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "i686")
|
|
|
|
set(KERNEL_ARCH i386)
|
|
|
|
elseif("${SERENITY_ARCH}" STREQUAL "x86_64")
|
|
|
|
set(KERNEL_ARCH x86_64)
|
|
|
|
endif()
|
|
|
|
|
2020-08-10 15:44:35 +00:00
|
|
|
set(KERNEL_HEAP_SOURCES
|
|
|
|
Heap/SlabAllocator.cpp
|
|
|
|
Heap/kmalloc.cpp
|
|
|
|
)
|
|
|
|
|
2020-10-17 11:39:36 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_STATIC}")
|
|
|
|
|
2020-05-06 15:40:06 +00:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
ACPI/DynamicParser.cpp
|
|
|
|
ACPI/Initialize.cpp
|
|
|
|
ACPI/MultiProcessorParser.cpp
|
|
|
|
ACPI/Parser.cpp
|
2021-02-14 20:47:10 +00:00
|
|
|
AddressSanitizer.cpp
|
2021-02-25 16:25:34 +00:00
|
|
|
Arch/PC/BIOS.cpp
|
|
|
|
Arch/x86/SmapDisabler.h
|
2021-06-25 06:46:17 +00:00
|
|
|
Bus/PCI/Access.cpp
|
|
|
|
Bus/PCI/Device.cpp
|
|
|
|
Bus/PCI/DeviceController.cpp
|
|
|
|
Bus/PCI/IOAccess.cpp
|
|
|
|
Bus/PCI/MMIOAccess.cpp
|
|
|
|
Bus/PCI/Initializer.cpp
|
|
|
|
Bus/PCI/WindowedMMIOAccess.cpp
|
2021-06-25 06:51:22 +00:00
|
|
|
Bus/USB/UHCIController.cpp
|
|
|
|
Bus/USB/USBDevice.cpp
|
|
|
|
Bus/USB/USBPipe.cpp
|
|
|
|
Bus/USB/USBTransfer.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
CMOS.cpp
|
|
|
|
CommandLine.cpp
|
2021-04-24 14:50:35 +00:00
|
|
|
ConsoleDevice.cpp
|
2020-11-06 08:09:51 +00:00
|
|
|
CoreDump.cpp
|
2020-11-02 18:16:01 +00:00
|
|
|
Devices/AsyncDeviceRequest.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
Devices/BlockDevice.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Devices/CharacterDevice.cpp
|
2021-01-01 10:20:55 +00:00
|
|
|
Devices/Device.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Devices/FullDevice.cpp
|
2021-01-29 12:03:25 +00:00
|
|
|
Devices/MemoryDevice.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Devices/NullDevice.cpp
|
2021-04-23 14:26:52 +00:00
|
|
|
Devices/PCISerialDevice.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Devices/PCSpeaker.cpp
|
|
|
|
Devices/RandomDevice.cpp
|
|
|
|
Devices/SB16.cpp
|
|
|
|
Devices/SerialDevice.cpp
|
|
|
|
Devices/VMWareBackdoor.cpp
|
|
|
|
Devices/ZeroDevice.cpp
|
2021-04-02 20:21:35 +00:00
|
|
|
Devices/HID/I8042Controller.cpp
|
|
|
|
Devices/HID/HIDManagement.cpp
|
|
|
|
Devices/HID/KeyboardDevice.cpp
|
|
|
|
Devices/HID/MouseDevice.cpp
|
|
|
|
Devices/HID/PS2KeyboardDevice.cpp
|
|
|
|
Devices/HID/PS2MouseDevice.cpp
|
|
|
|
Devices/HID/VMWareMouseDevice.cpp
|
2021-06-22 21:24:25 +00:00
|
|
|
GlobalProcessExposed.cpp
|
2021-06-12 12:30:05 +00:00
|
|
|
Graphics/Console/GenericFramebufferConsole.cpp
|
|
|
|
Graphics/Console/ContiguousFramebufferConsole.cpp
|
2021-04-16 19:58:51 +00:00
|
|
|
Graphics/Console/TextModeConsole.cpp
|
|
|
|
Graphics/Console/VGAConsole.cpp
|
2021-03-05 12:23:08 +00:00
|
|
|
Graphics/BochsGraphicsAdapter.cpp
|
|
|
|
Graphics/FramebufferDevice.cpp
|
|
|
|
Graphics/GraphicsManagement.cpp
|
2021-04-12 19:07:30 +00:00
|
|
|
Graphics/IntelNativeGraphicsAdapter.cpp
|
2021-06-12 13:07:44 +00:00
|
|
|
Graphics/VirtIOGPU/VirtIOFrameBufferDevice.cpp
|
|
|
|
Graphics/VirtIOGPU/VirtIOGPUConsole.cpp
|
|
|
|
Graphics/VirtIOGPU/VirtIOGPU.cpp
|
|
|
|
Graphics/VirtIOGPU/VirtIOGraphicsAdapter.cpp
|
2021-03-05 12:23:08 +00:00
|
|
|
Graphics/VGACompatibleAdapter.cpp
|
2020-12-25 18:23:35 +00:00
|
|
|
Storage/Partition/DiskPartition.cpp
|
2020-12-25 20:48:29 +00:00
|
|
|
Storage/Partition/DiskPartitionMetadata.cpp
|
2020-12-25 18:23:35 +00:00
|
|
|
Storage/Partition/EBRPartitionTable.cpp
|
2020-12-26 14:53:30 +00:00
|
|
|
Storage/Partition/GUIDPartitionTable.cpp
|
2020-12-25 18:23:35 +00:00
|
|
|
Storage/Partition/MBRPartitionTable.cpp
|
2020-12-26 14:53:30 +00:00
|
|
|
Storage/Partition/PartitionTable.cpp
|
2020-12-19 10:50:57 +00:00
|
|
|
Storage/StorageDevice.cpp
|
2021-02-26 04:25:45 +00:00
|
|
|
Storage/AHCIController.cpp
|
|
|
|
Storage/AHCIPort.cpp
|
|
|
|
Storage/AHCIPortHandler.cpp
|
|
|
|
Storage/SATADiskDevice.cpp
|
2021-03-27 06:01:00 +00:00
|
|
|
Storage/BMIDEChannel.cpp
|
2020-12-19 10:50:57 +00:00
|
|
|
Storage/IDEController.cpp
|
|
|
|
Storage/IDEChannel.cpp
|
|
|
|
Storage/PATADiskDevice.cpp
|
2021-01-19 21:33:00 +00:00
|
|
|
Storage/RamdiskController.cpp
|
|
|
|
Storage/RamdiskDevice.cpp
|
2020-12-19 13:25:06 +00:00
|
|
|
Storage/StorageManagement.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
DoubleBuffer.cpp
|
2021-01-15 10:28:07 +00:00
|
|
|
FileSystem/AnonymousFile.cpp
|
2020-07-02 09:48:08 +00:00
|
|
|
FileSystem/BlockBasedFileSystem.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
FileSystem/Custody.cpp
|
2020-12-25 17:26:38 +00:00
|
|
|
FileSystem/DevFS.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
FileSystem/DevPtsFS.cpp
|
|
|
|
FileSystem/Ext2FileSystem.cpp
|
|
|
|
FileSystem/FIFO.cpp
|
|
|
|
FileSystem/File.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
FileSystem/FileBackedFileSystem.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
FileSystem/FileDescription.cpp
|
|
|
|
FileSystem/FileSystem.cpp
|
|
|
|
FileSystem/Inode.cpp
|
|
|
|
FileSystem/InodeFile.cpp
|
|
|
|
FileSystem/InodeWatcher.cpp
|
2021-07-10 22:46:06 +00:00
|
|
|
FileSystem/Mount.cpp
|
2020-07-02 10:05:56 +00:00
|
|
|
FileSystem/Plan9FileSystem.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
FileSystem/ProcFS.cpp
|
2021-03-13 10:01:44 +00:00
|
|
|
FileSystem/SysFS.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
FileSystem/TmpFS.cpp
|
|
|
|
FileSystem/VirtualFileSystem.cpp
|
2020-12-22 06:21:58 +00:00
|
|
|
FutexQueue.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Interrupts/APIC.cpp
|
|
|
|
Interrupts/GenericInterruptHandler.cpp
|
|
|
|
Interrupts/IOAPIC.cpp
|
|
|
|
Interrupts/IRQHandler.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
Interrupts/InterruptManagement.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Interrupts/PIC.cpp
|
|
|
|
Interrupts/SharedIRQHandler.cpp
|
|
|
|
Interrupts/SpuriousInterruptHandler.cpp
|
|
|
|
Interrupts/UnhandledInterruptHandler.cpp
|
|
|
|
KBufferBuilder.cpp
|
2021-07-06 09:16:17 +00:00
|
|
|
KLexicalPath.cpp
|
2021-05-28 07:25:02 +00:00
|
|
|
KString.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
KSyms.cpp
|
|
|
|
Lock.cpp
|
2021-06-04 07:11:37 +00:00
|
|
|
Net/E1000ENetworkAdapter.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Net/E1000NetworkAdapter.cpp
|
|
|
|
Net/IPv4Socket.cpp
|
|
|
|
Net/LocalSocket.cpp
|
|
|
|
Net/LoopbackAdapter.cpp
|
2021-01-30 15:00:57 +00:00
|
|
|
Net/NE2000NetworkAdapter.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Net/NetworkAdapter.cpp
|
2021-06-04 04:43:16 +00:00
|
|
|
Net/NetworkingManagement.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Net/NetworkTask.cpp
|
|
|
|
Net/RTL8139NetworkAdapter.cpp
|
2021-04-02 14:53:31 +00:00
|
|
|
Net/RTL8168NetworkAdapter.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
Net/Routing.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Net/Socket.cpp
|
|
|
|
Net/TCPSocket.cpp
|
|
|
|
Net/UDPSocket.cpp
|
2021-02-14 08:01:52 +00:00
|
|
|
Panic.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
PerformanceEventBuffer.cpp
|
|
|
|
Process.cpp
|
Kernel: Introduce the new ProcFS design
The new ProcFS design consists of two main parts:
1. The representative ProcFS class, which is derived from the FS class.
The ProcFS and its inodes are much more lean - merely 3 classes to
represent the common type of inodes - regular files, symbolic links and
directories. They're backed by a ProcFSExposedComponent object, which
is responsible for the functional operation behind the scenes.
2. The backend of the ProcFS - the ProcFSComponentsRegistrar class
and all derived classes from the ProcFSExposedComponent class. These
together form the entire backend and handle all the functions you can
expect from the ProcFS.
The ProcFSExposedComponent derived classes split to 3 types in the
manner of lifetime in the kernel:
1. Persistent objects - this category includes all basic objects, like
the root folder, /proc/bus folder, main blob files in the root folders,
etc. These objects are persistent and cannot die ever.
2. Semi-persistent objects - this category includes all PID folders,
and subdirectories to the PID folders. It also includes exposed objects
like the unveil JSON'ed blob. These object are persistent as long as the
the responsible process they represent is still alive.
3. Dynamic objects - this category includes files in the subdirectories
of a PID folder, like /proc/PID/fd/* or /proc/PID/stacks/*. Essentially,
these objects are always created dynamically and when no longer in need
after being used, they're deallocated.
Nevertheless, the new allocated backend objects and inodes try to use
the same InodeIndex if possible - this might change only when a thread
dies and a new thread is born with a new thread stack, or when a file
descriptor is closed and a new one within the same file descriptor
number is opened. This is needed to actually be able to do something
useful with these objects.
The new design assures that many ProcFS instances can be used at once,
with one backend for usage for all instances.
2021-06-12 01:23:58 +00:00
|
|
|
ProcessExposed.cpp
|
2021-06-22 21:24:25 +00:00
|
|
|
ProcessSpecificExposed.cpp
|
2020-08-15 19:13:19 +00:00
|
|
|
ProcessGroup.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
RTC.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
Random.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Scheduler.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
StdLib.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Syscall.cpp
|
2021-01-15 10:28:07 +00:00
|
|
|
Syscalls/anon_create.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/access.cpp
|
|
|
|
Syscalls/alarm.cpp
|
|
|
|
Syscalls/beep.cpp
|
|
|
|
Syscalls/chdir.cpp
|
|
|
|
Syscalls/chmod.cpp
|
|
|
|
Syscalls/chown.cpp
|
|
|
|
Syscalls/chroot.cpp
|
|
|
|
Syscalls/clock.cpp
|
|
|
|
Syscalls/debug.cpp
|
2020-08-04 11:51:11 +00:00
|
|
|
Syscalls/disown.cpp
|
2020-08-15 08:54:00 +00:00
|
|
|
Syscalls/dup2.cpp
|
2021-03-09 07:16:00 +00:00
|
|
|
Syscalls/emuctl.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/execve.cpp
|
|
|
|
Syscalls/exit.cpp
|
|
|
|
Syscalls/fcntl.cpp
|
|
|
|
Syscalls/fork.cpp
|
|
|
|
Syscalls/ftruncate.cpp
|
|
|
|
Syscalls/futex.cpp
|
|
|
|
Syscalls/get_dir_entries.cpp
|
|
|
|
Syscalls/get_stack_bounds.cpp
|
|
|
|
Syscalls/getrandom.cpp
|
|
|
|
Syscalls/getuid.cpp
|
|
|
|
Syscalls/hostname.cpp
|
|
|
|
Syscalls/ioctl.cpp
|
2021-01-30 20:35:54 +00:00
|
|
|
Syscalls/keymap.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/kill.cpp
|
|
|
|
Syscalls/link.cpp
|
|
|
|
Syscalls/lseek.cpp
|
|
|
|
Syscalls/mkdir.cpp
|
|
|
|
Syscalls/mknod.cpp
|
|
|
|
Syscalls/mmap.cpp
|
|
|
|
Syscalls/module.cpp
|
|
|
|
Syscalls/mount.cpp
|
|
|
|
Syscalls/open.cpp
|
|
|
|
Syscalls/perf_event.cpp
|
|
|
|
Syscalls/pipe.cpp
|
|
|
|
Syscalls/pledge.cpp
|
2020-12-25 17:27:42 +00:00
|
|
|
Syscalls/prctl.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/process.cpp
|
|
|
|
Syscalls/profiling.cpp
|
|
|
|
Syscalls/ptrace.cpp
|
|
|
|
Syscalls/purge.cpp
|
|
|
|
Syscalls/read.cpp
|
|
|
|
Syscalls/readlink.cpp
|
|
|
|
Syscalls/realpath.cpp
|
|
|
|
Syscalls/rename.cpp
|
|
|
|
Syscalls/rmdir.cpp
|
|
|
|
Syscalls/sched.cpp
|
|
|
|
Syscalls/select.cpp
|
|
|
|
Syscalls/sendfd.cpp
|
|
|
|
Syscalls/setpgid.cpp
|
|
|
|
Syscalls/setuid.cpp
|
|
|
|
Syscalls/shutdown.cpp
|
|
|
|
Syscalls/sigaction.cpp
|
|
|
|
Syscalls/socket.cpp
|
|
|
|
Syscalls/stat.cpp
|
2021-05-19 09:31:43 +00:00
|
|
|
Syscalls/statvfs.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/sync.cpp
|
|
|
|
Syscalls/sysconf.cpp
|
|
|
|
Syscalls/thread.cpp
|
|
|
|
Syscalls/times.cpp
|
|
|
|
Syscalls/ttyname.cpp
|
|
|
|
Syscalls/umask.cpp
|
|
|
|
Syscalls/uname.cpp
|
|
|
|
Syscalls/unlink.cpp
|
|
|
|
Syscalls/unveil.cpp
|
|
|
|
Syscalls/utime.cpp
|
|
|
|
Syscalls/waitid.cpp
|
2021-05-12 19:17:51 +00:00
|
|
|
Syscalls/inode_watcher.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/write.cpp
|
2021-03-13 10:01:44 +00:00
|
|
|
SystemExposed.cpp
|
2021-04-16 19:58:51 +00:00
|
|
|
TTY/ConsoleManagement.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
TTY/MasterPTY.cpp
|
|
|
|
TTY/PTYMultiplexer.cpp
|
|
|
|
TTY/SlavePTY.cpp
|
|
|
|
TTY/TTY.cpp
|
|
|
|
TTY/VirtualConsole.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Tasks/FinalizerTask.cpp
|
|
|
|
Tasks/SyncTask.cpp
|
|
|
|
Thread.cpp
|
2020-11-29 23:05:27 +00:00
|
|
|
ThreadBlockers.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
ThreadTracer.cpp
|
2020-10-25 15:13:47 +00:00
|
|
|
Time/APICTimer.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Time/HPET.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
Time/HPETComparator.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Time/PIT.cpp
|
|
|
|
Time/RTC.cpp
|
|
|
|
Time/TimeManagement.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
TimerQueue.cpp
|
2021-02-05 18:44:26 +00:00
|
|
|
UBSanitizer.cpp
|
2020-09-12 03:11:07 +00:00
|
|
|
UserOrKernelBuffer.cpp
|
2021-04-15 09:22:02 +00:00
|
|
|
VirtIO/VirtIO.cpp
|
|
|
|
VirtIO/VirtIOConsole.cpp
|
2021-06-23 11:19:24 +00:00
|
|
|
VirtIO/VirtIOConsolePort.cpp
|
2021-04-15 09:22:02 +00:00
|
|
|
VirtIO/VirtIOQueue.cpp
|
2021-01-22 16:56:19 +00:00
|
|
|
VirtIO/VirtIORNG.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
VM/AnonymousVMObject.cpp
|
|
|
|
VM/ContiguousVMObject.cpp
|
|
|
|
VM/InodeVMObject.cpp
|
|
|
|
VM/MemoryManager.cpp
|
|
|
|
VM/PageDirectory.cpp
|
|
|
|
VM/PhysicalPage.cpp
|
|
|
|
VM/PhysicalRegion.cpp
|
|
|
|
VM/PrivateInodeVMObject.cpp
|
|
|
|
VM/ProcessPagingScope.cpp
|
2020-09-05 21:52:14 +00:00
|
|
|
VM/PurgeablePageRanges.cpp
|
2021-02-25 10:42:49 +00:00
|
|
|
VM/Range.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
VM/RangeAllocator.cpp
|
|
|
|
VM/Region.cpp
|
2021-05-12 14:58:05 +00:00
|
|
|
VM/RingBuffer.cpp
|
2021-01-20 16:34:16 +00:00
|
|
|
VM/ScatterGatherList.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
VM/SharedInodeVMObject.cpp
|
2021-02-08 14:45:40 +00:00
|
|
|
VM/Space.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
VM/VMObject.cpp
|
|
|
|
WaitQueue.cpp
|
2021-02-06 06:36:38 +00:00
|
|
|
WorkQueue.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
init.cpp
|
|
|
|
kprintf.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
)
|
|
|
|
|
2021-03-07 20:28:28 +00:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
2021-06-21 15:34:09 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/${KERNEL_ARCH}/ASM_wrapper.cpp
|
2021-07-04 22:55:09 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/${KERNEL_ARCH}/Boot/ap_setup.S
|
2021-06-21 15:34:09 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/${KERNEL_ARCH}/InterruptEntry.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/${KERNEL_ARCH}/Processor.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/ASM_wrapper.cpp
|
2021-07-04 22:55:09 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/Boot/boot.S
|
2021-06-24 11:00:17 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/Boot/multiboot.S
|
2021-06-23 19:54:41 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/CPU.cpp
|
2021-06-21 15:34:09 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/Interrupts.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/Processor.cpp
|
2021-06-23 19:54:41 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/ProcessorInfo.cpp
|
2021-06-27 12:12:55 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/SafeMem.cpp
|
2021-06-21 15:34:09 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/TrapFrame.cpp
|
2021-03-07 20:28:28 +00:00
|
|
|
)
|
|
|
|
|
2020-05-06 15:40:06 +00:00
|
|
|
set(AK_SOURCES
|
|
|
|
../AK/FlyString.cpp
|
2020-08-09 09:34:26 +00:00
|
|
|
../AK/GenericLexer.cpp
|
2020-12-31 11:17:03 +00:00
|
|
|
../AK/Hex.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
../AK/String.cpp
|
|
|
|
../AK/StringBuilder.cpp
|
|
|
|
../AK/StringImpl.cpp
|
|
|
|
../AK/StringUtils.cpp
|
|
|
|
../AK/StringView.cpp
|
2020-08-25 23:19:16 +00:00
|
|
|
../AK/Time.cpp
|
2020-09-22 11:05:40 +00:00
|
|
|
../AK/Format.cpp
|
2020-12-31 11:17:03 +00:00
|
|
|
../AK/UUID.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(ELF_SOURCES
|
2021-01-12 11:17:30 +00:00
|
|
|
../Userland/Libraries/LibELF/Image.cpp
|
|
|
|
../Userland/Libraries/LibELF/Validation.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
)
|
|
|
|
|
2021-05-08 18:37:43 +00:00
|
|
|
generate_state_machine(../Userland/Libraries/LibVT/StateMachine.txt ../Userland/Libraries/LibVT/EscapeSequenceStateMachine.h)
|
|
|
|
|
2020-05-26 21:35:14 +00:00
|
|
|
set(VT_SOURCES
|
2021-01-12 11:17:30 +00:00
|
|
|
../Userland/Libraries/LibVT/Terminal.cpp
|
|
|
|
../Userland/Libraries/LibVT/Line.cpp
|
2021-05-08 18:37:43 +00:00
|
|
|
../Userland/Libraries/LibVT/EscapeSequenceParser.cpp
|
2020-05-26 21:35:14 +00:00
|
|
|
)
|
|
|
|
|
2020-06-10 08:22:31 +00:00
|
|
|
set(KEYBOARD_SOURCES
|
2021-01-12 11:17:30 +00:00
|
|
|
../Userland/Libraries/LibKeyboard/CharacterMap.cpp
|
2020-06-10 08:22:31 +00:00
|
|
|
)
|
|
|
|
|
2020-06-23 02:23:35 +00:00
|
|
|
set(CRYPTO_SOURCES
|
2021-01-12 11:17:30 +00:00
|
|
|
../Userland/Libraries/LibCrypto/Cipher/AES.cpp
|
|
|
|
../Userland/Libraries/LibCrypto/Hash/SHA2.cpp
|
2020-06-23 02:23:35 +00:00
|
|
|
)
|
|
|
|
|
2020-05-06 15:40:06 +00:00
|
|
|
set(SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
|
|
|
${AK_SOURCES}
|
|
|
|
${ELF_SOURCES}
|
2020-05-26 21:35:14 +00:00
|
|
|
${VT_SOURCES}
|
2020-06-10 08:22:31 +00:00
|
|
|
${KEYBOARD_SOURCES}
|
2020-06-23 02:23:35 +00:00
|
|
|
${CRYPTO_SOURCES}
|
2020-05-06 15:40:06 +00:00
|
|
|
)
|
|
|
|
|
2021-04-16 22:37:24 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option -Wvla -Wnull-dereference")
|
2021-06-26 04:28:50 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -ffreestanding -fbuiltin")
|
2020-05-06 15:40:06 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-80387 -mno-mmx -mno-sse -mno-sse2")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-asynchronous-unwind-tables")
|
2021-01-02 11:02:42 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong")
|
2021-07-06 10:36:18 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
|
2021-02-14 21:49:25 +00:00
|
|
|
if (NOT ${CMAKE_HOST_SYSTEM_NAME} MATCHES SerenityOS)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib -nostdinc -nostdinc++")
|
|
|
|
endif()
|
2020-05-06 15:40:06 +00:00
|
|
|
|
2021-03-04 16:50:05 +00:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
2021-06-28 15:19:18 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcmodel=large -fno-pic -mno-red-zone")
|
2021-06-26 04:28:50 +00:00
|
|
|
else()
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pie -fPIE")
|
2021-03-04 16:50:05 +00:00
|
|
|
endif()
|
|
|
|
|
2021-02-24 19:47:56 +00:00
|
|
|
# Kernel Undefined Behavior Sanitizer (KUBSAN)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
|
|
|
|
|
2021-02-14 20:47:10 +00:00
|
|
|
# Kernel Address Sanitize (KASAN) implementation is still a work in progress, this option
|
|
|
|
# is not currently meant to be used, besides when developing Kernel ASAN support.
|
|
|
|
#
|
|
|
|
if (ENABLE_KERNEL_ADDRESS_SANITIZER)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=kernel-address")
|
|
|
|
endif()
|
|
|
|
|
2021-02-11 20:20:10 +00:00
|
|
|
add_compile_definitions(KERNEL)
|
|
|
|
|
|
|
|
# HACK: This is a workaround for CLion to grok the kernel sources.
|
|
|
|
# It's needed because CLion doesn't understand the way we switch compilers mid-build.
|
|
|
|
add_compile_definitions(__serenity__)
|
|
|
|
|
2021-06-18 17:04:39 +00:00
|
|
|
add_link_options(LINKER:-T ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld -nostdlib)
|
2021-02-24 05:08:21 +00:00
|
|
|
|
2020-08-10 15:44:35 +00:00
|
|
|
add_library(kernel_heap STATIC ${KERNEL_HEAP_SOURCES})
|
2020-05-06 15:40:06 +00:00
|
|
|
|
|
|
|
if (${CMAKE_HOST_SYSTEM_NAME} MATCHES SerenityOS)
|
2021-04-27 07:25:02 +00:00
|
|
|
include_directories(/usr/local/include/c++/${GCC_VERSION}/)
|
2020-05-06 15:40:06 +00:00
|
|
|
else()
|
2021-07-06 10:36:18 +00:00
|
|
|
if (NOT EXISTS ${TOOLCHAIN_ROOT}/${SERENITY_ARCH}-pc-serenity/include/c++/${GCC_VERSION}/)
|
2021-05-13 11:15:35 +00:00
|
|
|
message(FATAL_ERROR "Toolchain version ${GCC_VERSION} appears to be missing! Please run: Meta/serenity.sh rebuild-toolchain")
|
2021-04-27 07:30:33 +00:00
|
|
|
endif()
|
2021-07-06 10:36:18 +00:00
|
|
|
include_directories(${TOOLCHAIN_ROOT}/${SERENITY_ARCH}-pc-serenity/include/c++/${GCC_VERSION}/)
|
|
|
|
include_directories(${TOOLCHAIN_ROOT}/${SERENITY_ARCH}-pc-serenity/include/c++/${GCC_VERSION}/${SERENITY_ARCH}-pc-serenity/)
|
|
|
|
link_directories(${TOOLCHAIN_ROOT}/${SERENITY_ARCH}-pc-serenity/lib)
|
|
|
|
link_directories(${TOOLCHAIN_ROOT}/lib/gcc/${SERENITY_ARCH}-pc-serenity/${GCC_VERSION}/)
|
2020-05-06 15:40:06 +00:00
|
|
|
endif()
|
|
|
|
|
2021-06-24 11:08:19 +00:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "i686")
|
|
|
|
set(KERNEL_TARGET Kernel32)
|
|
|
|
else()
|
|
|
|
set(KERNEL_TARGET Kernel64)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(${KERNEL_TARGET} ${SOURCES})
|
|
|
|
add_dependencies(${KERNEL_TARGET} generate_EscapeSequenceStateMachine.h)
|
2021-05-20 09:44:23 +00:00
|
|
|
|
2021-06-24 11:08:19 +00:00
|
|
|
set_target_properties(${KERNEL_TARGET} PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld)
|
2021-06-17 17:26:37 +00:00
|
|
|
|
2021-04-29 13:25:31 +00:00
|
|
|
if (ENABLE_KERNEL_LTO)
|
|
|
|
include(CheckIPOSupported)
|
|
|
|
check_ipo_supported()
|
2021-06-24 11:08:19 +00:00
|
|
|
set_property(TARGET ${KERNEL_TARGET} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
2021-04-29 13:25:31 +00:00
|
|
|
endif()
|
2021-07-06 10:35:26 +00:00
|
|
|
target_link_libraries(${KERNEL_TARGET} kernel_heap gcc)
|
2021-06-24 11:08:19 +00:00
|
|
|
add_dependencies(${KERNEL_TARGET} kernel_heap)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
TARGET ${KERNEL_TARGET} POST_BUILD
|
|
|
|
COMMAND ${TOOLCHAIN_PREFIX}objcopy -O elf32-i386 ${CMAKE_CURRENT_BINARY_DIR}/${KERNEL_TARGET} ${CMAKE_CURRENT_BINARY_DIR}/Kernel
|
|
|
|
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Kernel
|
|
|
|
)
|
|
|
|
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Kernel" DESTINATION boot)
|
2020-05-06 15:40:06 +00:00
|
|
|
|
|
|
|
add_custom_command(
|
2021-06-24 11:08:19 +00:00
|
|
|
TARGET ${KERNEL_TARGET} POST_BUILD
|
2020-05-06 15:40:06 +00:00
|
|
|
COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/mkmap.sh
|
|
|
|
)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kernel.map DESTINATION res)
|
|
|
|
|
2020-05-26 18:20:24 +00:00
|
|
|
serenity_install_headers(Kernel)
|
2020-08-15 12:11:10 +00:00
|
|
|
serenity_install_sources(Kernel)
|
2020-05-26 18:20:24 +00:00
|
|
|
|
2020-05-06 15:40:06 +00:00
|
|
|
add_subdirectory(Modules)
|