2021-05-23 23:20:22 +03:00
|
|
|
if (ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS)
|
|
|
|
add_compile_options(-Og)
|
|
|
|
add_compile_options(-ggdb3)
|
|
|
|
else()
|
2021-12-14 11:42:26 +03:00
|
|
|
add_compile_options(-O2)
|
2021-05-23 23:20:22 +03:00
|
|
|
endif()
|
2021-02-24 13:30:19 +03:00
|
|
|
|
2021-08-27 22:23:43 +03:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
set(KERNEL_ARCH aarch64)
|
2021-03-04 19:50:05 +03:00
|
|
|
elseif("${SERENITY_ARCH}" STREQUAL "x86_64")
|
|
|
|
set(KERNEL_ARCH x86_64)
|
2023-08-17 12:32:32 +03:00
|
|
|
elseif("${SERENITY_ARCH}" STREQUAL "riscv64")
|
|
|
|
set(KERNEL_ARCH riscv64)
|
2021-03-04 19:50:05 +03:00
|
|
|
endif()
|
|
|
|
|
2020-08-10 18:44:35 +03:00
|
|
|
set(KERNEL_HEAP_SOURCES
|
|
|
|
Heap/kmalloc.cpp
|
|
|
|
)
|
|
|
|
|
2020-05-06 18:40:06 +03:00
|
|
|
set(KERNEL_SOURCES
|
2023-04-01 03:10:19 +03:00
|
|
|
Arch/init.cpp
|
2023-01-08 19:42:07 +03:00
|
|
|
Arch/PageFault.cpp
|
2023-02-23 01:32:00 +03:00
|
|
|
Arch/DeferredCallPool.cpp
|
2023-02-24 21:21:53 +03:00
|
|
|
Boot/CommandLine.cpp
|
2022-09-02 13:41:48 +03:00
|
|
|
Bus/PCI/Controller/HostController.cpp
|
2022-01-07 15:10:44 +03:00
|
|
|
Bus/PCI/Controller/MemoryBackedHostBridge.cpp
|
2022-01-15 10:17:07 +03:00
|
|
|
Bus/PCI/Controller/VolumeManagementDevice.cpp
|
2021-06-25 09:46:17 +03:00
|
|
|
Bus/PCI/Access.cpp
|
Kernel/PCI: Simplify the entire subsystem
A couple of things were changed:
1. Semantic changes - PCI segments are now called PCI domains, to better
match what they are really. It's also the name that Linux gave, and it
seems that Wikipedia also uses this name.
We also remove PCI::ChangeableAddress, because it was used in the past
but now it's no longer being used.
2. There are no WindowedMMIOAccess or MMIOAccess classes anymore, as
they made a bunch of unnecessary complexity. Instead, Windowed access is
removed entirely (this was tested, but never was benchmarked), so we are
left with IO access and memory access options. The memory access option
is essentially mapping the PCI bus (from the chosen PCI domain), to
virtual memory as-is. This means that unless needed, at any time, there
is only one PCI bus being mapped, and this is changed if access to
another PCI bus in the same PCI domain is needed. For now, we don't
support mapping of different PCI buses from different PCI domains at the
same time, because basically it's still a non-issue for most machines
out there.
2. OOM-safety is increased, especially when constructing the Access
object. It means that we pre-allocating any needed resources, and we try
to find PCI domains (if requested to initialize memory access) after we
attempt to construct the Access object, so it's possible to fail at this
point "gracefully".
3. All PCI API functions are now separated into a different header file,
which means only "clients" of the PCI subsystem API will need to include
that header file.
4. Functional changes - we only allow now to enumerate the bus after
a hardware scan. This means that the old method "enumerate_hardware"
is removed, so, when initializing an Access object, the initializing
function must call rescan on it to force it to find devices. This makes
it possible to fail rescan, and also to defer it after construction from
both OOM-safety terms and hotplug capabilities.
2021-09-07 12:08:38 +03:00
|
|
|
Bus/PCI/API.cpp
|
2021-08-21 06:58:43 +03:00
|
|
|
Bus/PCI/Device.cpp
|
Kernel/PCI: Hold a reference to DeviceIdentifier in the Device class
There are now 2 separate classes for almost the same object type:
- EnumerableDeviceIdentifier, which is used in the enumeration code for
all PCI host controller classes. This is allowed to be moved and
copied, as it doesn't support ref-counting.
- DeviceIdentifier, which inherits from EnumerableDeviceIdentifier. This
class uses ref-counting, and is not allowed to be copied. It has a
spinlock member in its structure to allow safely executing complicated
IO sequences on a PCI device and its space configuration.
There's a static method that allows a quick conversion from
EnumerableDeviceIdentifier to DeviceIdentifier while creating a
NonnullRefPtr out of it.
The reason for doing this is for the sake of integrity and reliablity of
the system in 2 places:
- Ensure that "complicated" tasks that rely on manipulating PCI device
registers are done in a safe manner. For example, determining a PCI
BAR space size requires multiple read and writes to the same register,
and if another CPU tries to do something else with our selected
register, then the result will be a catastrophe.
- Allow the PCI API to have a united form around a shared object which
actually holds much more data than the PCI::Address structure. This is
fundamental if we want to do certain types of optimizations, and be
able to support more features of the PCI bus in the foreseeable
future.
This patch already has several implications:
- All PCI::Device(s) hold a reference to a DeviceIdentifier structure
being given originally from the PCI::Access singleton. This means that
all instances of DeviceIdentifier structures are located in one place,
and all references are pointing to that location. This ensures that
locking the operation spinlock will take effect in all the appropriate
places.
- We no longer support adding PCI host controllers and then immediately
allow for enumerating it with a lambda function. It was found that
this method is extremely broken and too much complicated to work
reliably with the new paradigm being introduced in this patch. This
means that for Volume Management Devices (Intel VMD devices), we
simply first enumerate the PCI bus for such devices in the storage
code, and if we find a device, we attach it in the PCI::Access method
which will scan for devices behind that bridge and will add new
DeviceIdentifier(s) objects to its internal Vector. Afterwards, we
just continue as usual with scanning for actual storage controllers,
so we will find a corresponding NVMe controllers if there were any
behind that VMD bridge.
2022-02-10 19:33:13 +03:00
|
|
|
Bus/PCI/DeviceIdentifier.cpp
|
2021-08-13 09:10:43 +03:00
|
|
|
Bus/USB/UHCI/UHCIController.cpp
|
|
|
|
Bus/USB/UHCI/UHCIRootHub.cpp
|
2022-04-14 18:11:15 +03:00
|
|
|
Bus/USB/USBConfiguration.cpp
|
2021-08-08 21:50:20 +03:00
|
|
|
Bus/USB/USBController.cpp
|
2021-06-25 09:51:22 +03:00
|
|
|
Bus/USB/USBDevice.cpp
|
2021-08-13 22:47:13 +03:00
|
|
|
Bus/USB/USBHub.cpp
|
2021-08-08 21:50:20 +03:00
|
|
|
Bus/USB/USBManagement.cpp
|
2021-06-25 09:51:22 +03:00
|
|
|
Bus/USB/USBPipe.cpp
|
|
|
|
Bus/USB/USBTransfer.cpp
|
2021-08-27 12:24:50 +03:00
|
|
|
Bus/VirtIO/Console.cpp
|
|
|
|
Bus/VirtIO/ConsolePort.cpp
|
|
|
|
Bus/VirtIO/Device.cpp
|
|
|
|
Bus/VirtIO/Queue.cpp
|
|
|
|
Bus/VirtIO/RNG.cpp
|
2020-11-02 21:16:01 +03:00
|
|
|
Devices/AsyncDeviceRequest.cpp
|
2023-06-19 22:12:45 +03:00
|
|
|
Devices/Audio/AC97/AC97.cpp
|
2022-02-11 22:47:45 +03:00
|
|
|
Devices/Audio/Channel.cpp
|
2023-03-10 22:10:06 +03:00
|
|
|
Devices/Audio/IntelHDA/Codec.cpp
|
|
|
|
Devices/Audio/IntelHDA/Controller.cpp
|
|
|
|
Devices/Audio/IntelHDA/Format.cpp
|
2023-07-04 12:18:05 +03:00
|
|
|
Devices/Audio/IntelHDA/InterruptHandler.cpp
|
2023-03-10 22:10:06 +03:00
|
|
|
Devices/Audio/IntelHDA/Stream.cpp
|
2022-02-11 22:47:45 +03:00
|
|
|
Devices/Audio/Management.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
Devices/BlockDevice.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Devices/CharacterDevice.cpp
|
2021-01-01 13:20:55 +03:00
|
|
|
Devices/Device.cpp
|
2021-09-11 09:19:20 +03:00
|
|
|
Devices/DeviceManagement.cpp
|
2021-06-07 02:15:07 +03:00
|
|
|
Devices/KCOVDevice.cpp
|
|
|
|
Devices/KCOVInstance.cpp
|
2021-04-23 17:26:52 +03:00
|
|
|
Devices/PCISerialDevice.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Devices/SerialDevice.cpp
|
2021-04-02 23:21:35 +03:00
|
|
|
Devices/HID/KeyboardDevice.cpp
|
2022-12-20 00:53:51 +03:00
|
|
|
Devices/HID/Management.cpp
|
2021-04-02 23:21:35 +03:00
|
|
|
Devices/HID/MouseDevice.cpp
|
2023-05-12 18:04:01 +03:00
|
|
|
Devices/HID/PS2/KeyboardDevice.cpp
|
|
|
|
Devices/HID/PS2/MouseDevice.cpp
|
2023-03-18 14:17:13 +03:00
|
|
|
Devices/Generic/ConsoleDevice.cpp
|
|
|
|
Devices/Generic/DeviceControlDevice.cpp
|
|
|
|
Devices/Generic/FullDevice.cpp
|
|
|
|
Devices/Generic/MemoryDevice.cpp
|
|
|
|
Devices/Generic/NullDevice.cpp
|
|
|
|
Devices/Generic/RandomDevice.cpp
|
|
|
|
Devices/Generic/SelfTTYDevice.cpp
|
|
|
|
Devices/Generic/ZeroDevice.cpp
|
2023-06-03 14:47:47 +03:00
|
|
|
Devices/GPU/Bochs/GraphicsAdapter.cpp
|
|
|
|
Devices/GPU/Bochs/QEMUDisplayConnector.cpp
|
|
|
|
Devices/GPU/Console/BootFramebufferConsole.cpp
|
|
|
|
Devices/GPU/Console/GenericFramebufferConsole.cpp
|
|
|
|
Devices/GPU/Console/ContiguousFramebufferConsole.cpp
|
|
|
|
Devices/GPU/Console/VGATextModeConsole.cpp
|
|
|
|
Devices/GPU/DisplayConnector.cpp
|
|
|
|
Devices/GPU/Generic/DisplayConnector.cpp
|
|
|
|
Devices/GPU/Management.cpp
|
|
|
|
Devices/GPU/Intel/Auxiliary/GMBusConnector.cpp
|
|
|
|
Devices/GPU/Intel/Plane/DisplayPlane.cpp
|
|
|
|
Devices/GPU/Intel/Plane/G33DisplayPlane.cpp
|
|
|
|
Devices/GPU/Intel/Transcoder/AnalogDisplayTranscoder.cpp
|
|
|
|
Devices/GPU/Intel/Transcoder/DisplayTranscoder.cpp
|
|
|
|
Devices/GPU/Intel/Transcoder/PLL.cpp
|
|
|
|
Devices/GPU/Intel/DisplayConnectorGroup.cpp
|
|
|
|
Devices/GPU/Intel/NativeDisplayConnector.cpp
|
|
|
|
Devices/GPU/Intel/NativeGraphicsAdapter.cpp
|
|
|
|
Devices/GPU/VMWare/Console.cpp
|
|
|
|
Devices/GPU/VMWare/GraphicsAdapter.cpp
|
|
|
|
Devices/GPU/VMWare/DisplayConnector.cpp
|
|
|
|
Devices/GPU/VirtIO/DisplayConnector.cpp
|
|
|
|
Devices/GPU/VirtIO/Console.cpp
|
|
|
|
Devices/GPU/VirtIO/GPU3DDevice.cpp
|
|
|
|
Devices/GPU/VirtIO/GraphicsAdapter.cpp
|
2023-03-18 14:32:12 +03:00
|
|
|
Devices/Storage/ATA/AHCI/Controller.cpp
|
|
|
|
Devices/Storage/ATA/AHCI/Port.cpp
|
|
|
|
Devices/Storage/ATA/AHCI/InterruptHandler.cpp
|
|
|
|
Devices/Storage/ATA/GenericIDE/Controller.cpp
|
|
|
|
Devices/Storage/ATA/GenericIDE/Channel.cpp
|
|
|
|
Devices/Storage/ATA/ATAController.cpp
|
|
|
|
Devices/Storage/ATA/ATADevice.cpp
|
|
|
|
Devices/Storage/ATA/ATADiskDevice.cpp
|
|
|
|
Devices/Storage/ATA/ATAPort.cpp
|
|
|
|
Devices/Storage/NVMe/NVMeController.cpp
|
|
|
|
Devices/Storage/NVMe/NVMeNameSpace.cpp
|
|
|
|
Devices/Storage/NVMe/NVMeInterruptQueue.cpp
|
|
|
|
Devices/Storage/NVMe/NVMePollQueue.cpp
|
|
|
|
Devices/Storage/NVMe/NVMeQueue.cpp
|
|
|
|
Devices/Storage/SD/PCISDHostController.cpp
|
|
|
|
Devices/Storage/SD/SDHostController.cpp
|
|
|
|
Devices/Storage/SD/SDMemoryCard.cpp
|
|
|
|
Devices/Storage/DiskPartition.cpp
|
|
|
|
Devices/Storage/StorageController.cpp
|
|
|
|
Devices/Storage/StorageDevice.cpp
|
|
|
|
Devices/Storage/StorageManagement.cpp
|
2021-06-07 02:15:07 +03:00
|
|
|
SanCov.cpp
|
2021-01-15 13:28:07 +03:00
|
|
|
FileSystem/AnonymousFile.cpp
|
2020-07-02 12:48:08 +03:00
|
|
|
FileSystem/BlockBasedFileSystem.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
FileSystem/Custody.cpp
|
2022-10-24 10:38:41 +03:00
|
|
|
FileSystem/DevPtsFS/FileSystem.cpp
|
|
|
|
FileSystem/DevPtsFS/Inode.cpp
|
2022-10-24 10:02:37 +03:00
|
|
|
FileSystem/Ext2FS/FileSystem.cpp
|
|
|
|
FileSystem/Ext2FS/Inode.cpp
|
2022-10-24 08:25:16 +03:00
|
|
|
FileSystem/FATFS/FileSystem.cpp
|
|
|
|
FileSystem/FATFS/Inode.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
FileSystem/FIFO.cpp
|
|
|
|
FileSystem/File.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
FileSystem/FileBackedFileSystem.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
FileSystem/FileSystem.cpp
|
|
|
|
FileSystem/Inode.cpp
|
|
|
|
FileSystem/InodeFile.cpp
|
2022-08-19 23:20:43 +03:00
|
|
|
FileSystem/InodeMetadata.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
FileSystem/InodeWatcher.cpp
|
2022-10-24 11:02:50 +03:00
|
|
|
FileSystem/ISO9660FS/DirectoryIterator.cpp
|
|
|
|
FileSystem/ISO9660FS/FileSystem.cpp
|
|
|
|
FileSystem/ISO9660FS/Inode.cpp
|
2021-07-11 01:46:06 +03:00
|
|
|
FileSystem/Mount.cpp
|
2022-12-15 12:42:40 +03:00
|
|
|
FileSystem/MountFile.cpp
|
2021-09-07 14:39:11 +03:00
|
|
|
FileSystem/OpenFileDescription.cpp
|
2022-10-24 10:28:24 +03:00
|
|
|
FileSystem/Plan9FS/FileSystem.cpp
|
|
|
|
FileSystem/Plan9FS/Inode.cpp
|
|
|
|
FileSystem/Plan9FS/Message.cpp
|
2022-10-24 09:41:31 +03:00
|
|
|
FileSystem/ProcFS/FileSystem.cpp
|
|
|
|
FileSystem/ProcFS/Inode.cpp
|
2023-02-20 18:51:18 +03:00
|
|
|
FileSystem/ProcFS/ProcessExposed.cpp
|
Kernel+SystemServer+Base: Introduce the RAMFS filesystem
This filesystem is based on the code of the long-lived TmpFS. It differs
from that filesystem in one keypoint - its root inode doesn't have a
sticky bit on it.
Therefore, we mount it on /dev, to ensure only root can modify files on
that directory. In addition to that, /tmp is mounted directly in the
SystemServer main (start) code, so it's no longer specified in the fstab
file. We ensure that /tmp has a sticky bit and has the value 0777 for
root directory permissions, which is certainly a special case when using
RAM-backed (and in general other) filesystems.
Because of these 2 changes, it's no longer needed to maintain the TmpFS
filesystem, hence it's removed (renamed to RAMFS), because the RAMFS
represents the purpose of this filesystem in a much better way - it
relies on being backed by RAM "storage", and therefore it's easy to
conclude it's temporary and volatile, so its content is gone on either
system shutdown or unmounting of the filesystem.
2023-01-28 20:00:54 +03:00
|
|
|
FileSystem/RAMFS/FileSystem.cpp
|
|
|
|
FileSystem/RAMFS/Inode.cpp
|
2022-04-22 09:44:31 +03:00
|
|
|
FileSystem/SysFS/Component.cpp
|
2022-10-23 21:51:56 +03:00
|
|
|
FileSystem/SysFS/DirectoryInode.cpp
|
|
|
|
FileSystem/SysFS/FileSystem.cpp
|
|
|
|
FileSystem/SysFS/Inode.cpp
|
|
|
|
FileSystem/SysFS/LinkInode.cpp
|
2022-04-22 12:46:19 +03:00
|
|
|
FileSystem/SysFS/Registry.cpp
|
|
|
|
FileSystem/SysFS/RootDirectory.cpp
|
2022-04-22 10:17:13 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Bus/PCI/BusDirectory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Bus/PCI/DeviceAttribute.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Bus/PCI/DeviceDirectory.cpp
|
2022-02-10 21:35:30 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Bus/PCI/DeviceExpansionROM.cpp
|
2022-04-22 10:04:37 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Bus/USB/BusDirectory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Bus/USB/DeviceInformation.cpp
|
2022-04-22 12:46:19 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Bus/Directory.cpp
|
2022-04-22 15:51:45 +03:00
|
|
|
FileSystem/SysFS/Subsystems/DeviceIdentifiers/BlockDevicesDirectory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/DeviceIdentifiers/CharacterDevicesDirectory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/DeviceIdentifiers/DeviceComponent.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/DeviceIdentifiers/Directory.cpp
|
2022-04-23 11:48:40 +03:00
|
|
|
FileSystem/SysFS/Subsystems/DeviceIdentifiers/SymbolicLinkDeviceComponent.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Devices/Storage/DeviceAttribute.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Devices/Storage/DeviceDirectory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Devices/Storage/Directory.cpp
|
Kernel/SysFS: Add exposing interface for DisplayConnectors
Under normal conditions (when mounting SysFS in /sys), there will be a
new directory in the /sys/devices directory called "graphics".
For now, under that directory there will be only a sub-directory called
"connectors" which will contain all DisplayConnectors' details, each in
its own sub-directory too, distinguished in naming with its minor
number.
Therefore, /sys/devices/graphics/connectors/MINOR_NUMBER/ will contain:
- General device attributes such as mutable_mode_setting_capable,
double_buffering_capable, flush_support, partial_flush_support and
refresh_rate_support. These values are exposed in the ioctl interface
of the DisplayConnector class too, but these can be useful later on
for command line utilities that want/need to expose these basic
settings.
- The EDID blob, simply named "edid". This will help userspace to fetch
the edid without the need of using the ioctl interface later on.
2022-07-16 08:08:53 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Devices/Graphics/Directory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Devices/Graphics/DisplayConnector/Directory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Devices/Graphics/DisplayConnector/DeviceDirectory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Devices/Graphics/DisplayConnector/DeviceAttribute.cpp
|
2022-04-23 11:48:40 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Devices/Directory.cpp
|
2022-04-22 09:44:31 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Firmware/Directory.cpp
|
2022-10-14 20:51:51 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Interrupts.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Processes.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/CPUInfo.cpp
|
2022-11-02 23:26:02 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Jails.cpp
|
2022-10-14 20:51:51 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Keymap.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Profile.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Directory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/DiskUsage.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Log.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/SystemStatistics.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/GlobalInformation.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/MemoryStatus.cpp
|
2022-10-15 05:57:20 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/PowerStateSwitch.cpp
|
2022-10-14 20:51:51 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Uptime.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Network/Adapters.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Network/ARP.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Network/Directory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Network/Local.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Network/Route.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Network/TCP.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Network/UDP.cpp
|
2023-02-18 19:52:44 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Constants/ConstantInformation.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Constants/Directory.cpp
|
2022-10-14 20:51:51 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Variables/BooleanVariable.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Variables/CapsLockRemap.cpp
|
2022-11-26 15:42:35 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Variables/CoredumpDirectory.cpp
|
2022-10-14 20:51:51 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Variables/Directory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Variables/DumpKmallocStack.cpp
|
2022-11-26 15:42:35 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Variables/StringVariable.cpp
|
2022-10-14 20:51:51 +03:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Variables/UBSANDeadly.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
FileSystem/VirtualFileSystem.cpp
|
2021-09-11 10:39:47 +03:00
|
|
|
Firmware/ACPI/Initialize.cpp
|
|
|
|
Firmware/ACPI/Parser.cpp
|
2023-06-09 22:50:11 +03:00
|
|
|
Firmware/ACPI/StaticParsing.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Interrupts/GenericInterruptHandler.cpp
|
|
|
|
Interrupts/IRQHandler.cpp
|
2023-04-29 22:50:01 +03:00
|
|
|
Interrupts/PCIIRQHandler.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Interrupts/SharedIRQHandler.cpp
|
|
|
|
Interrupts/UnhandledInterruptHandler.cpp
|
|
|
|
KSyms.cpp
|
2021-08-06 14:57:39 +03:00
|
|
|
Memory/AddressSpace.cpp
|
2021-08-06 11:45:34 +03:00
|
|
|
Memory/AnonymousVMObject.cpp
|
|
|
|
Memory/InodeVMObject.cpp
|
|
|
|
Memory/MemoryManager.cpp
|
|
|
|
Memory/PhysicalPage.cpp
|
|
|
|
Memory/PhysicalRegion.cpp
|
|
|
|
Memory/PhysicalZone.cpp
|
|
|
|
Memory/PrivateInodeVMObject.cpp
|
|
|
|
Memory/Region.cpp
|
2022-04-02 22:12:05 +03:00
|
|
|
Memory/RegionTree.cpp
|
2021-08-06 11:45:34 +03:00
|
|
|
Memory/RingBuffer.cpp
|
|
|
|
Memory/ScatterGatherList.cpp
|
2022-01-10 21:01:01 +03:00
|
|
|
Memory/ScopedAddressSpaceSwitcher.cpp
|
2022-05-13 03:22:23 +03:00
|
|
|
Memory/SharedFramebufferVMObject.cpp
|
2021-08-06 11:45:34 +03:00
|
|
|
Memory/SharedInodeVMObject.cpp
|
|
|
|
Memory/VMObject.cpp
|
2021-08-06 14:54:48 +03:00
|
|
|
Memory/VirtualRange.cpp
|
2021-09-07 12:40:31 +03:00
|
|
|
Locking/LockRank.cpp
|
2021-07-18 10:10:27 +03:00
|
|
|
Locking/Mutex.cpp
|
2023-02-24 21:10:59 +03:00
|
|
|
Library/DoubleBuffer.cpp
|
|
|
|
Library/IOWindow.cpp
|
|
|
|
Library/MiniStdLib.cpp
|
|
|
|
Library/Panic.cpp
|
|
|
|
Library/ScopedCritical.cpp
|
|
|
|
Library/StdLib.cpp
|
|
|
|
Library/KBufferBuilder.cpp
|
|
|
|
Library/KLexicalPath.cpp
|
|
|
|
Library/KString.cpp
|
|
|
|
Library/UserOrKernelBuffer.cpp
|
2021-12-25 11:58:04 +03:00
|
|
|
Net/Intel/E1000ENetworkAdapter.cpp
|
|
|
|
Net/Intel/E1000NetworkAdapter.cpp
|
2021-12-25 12:09:34 +03:00
|
|
|
Net/Realtek/RTL8168NetworkAdapter.cpp
|
2023-07-02 18:39:47 +03:00
|
|
|
Net/VirtIO/VirtIONetworkAdapter.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Net/IPv4Socket.cpp
|
|
|
|
Net/LocalSocket.cpp
|
|
|
|
Net/LoopbackAdapter.cpp
|
|
|
|
Net/NetworkAdapter.cpp
|
|
|
|
Net/NetworkTask.cpp
|
2021-08-06 11:45:34 +03:00
|
|
|
Net/NetworkingManagement.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
Net/Routing.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Net/Socket.cpp
|
|
|
|
Net/TCPSocket.cpp
|
|
|
|
Net/UDPSocket.cpp
|
2023-02-24 20:52:16 +03:00
|
|
|
Security/AddressSanitizer.cpp
|
2023-02-24 20:57:27 +03:00
|
|
|
Security/Credentials.cpp
|
2023-02-24 20:49:37 +03:00
|
|
|
Security/Random.cpp
|
2023-02-24 20:34:21 +03:00
|
|
|
Security/Jail.cpp
|
2023-02-24 20:52:16 +03:00
|
|
|
Security/UBSanitizer.cpp
|
2021-01-15 13:28:07 +03:00
|
|
|
Syscalls/anon_create.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/alarm.cpp
|
|
|
|
Syscalls/beep.cpp
|
|
|
|
Syscalls/chdir.cpp
|
|
|
|
Syscalls/chmod.cpp
|
|
|
|
Syscalls/chown.cpp
|
|
|
|
Syscalls/clock.cpp
|
|
|
|
Syscalls/debug.cpp
|
2020-08-04 14:51:11 +03:00
|
|
|
Syscalls/disown.cpp
|
2020-08-15 11:54:00 +03:00
|
|
|
Syscalls/dup2.cpp
|
2021-03-09 10:16:00 +03:00
|
|
|
Syscalls/emuctl.cpp
|
2023-01-25 19:13:12 +03:00
|
|
|
Syscalls/execve.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/exit.cpp
|
2022-10-01 15:24:56 +03:00
|
|
|
Syscalls/faccessat.cpp
|
2022-06-18 19:37:54 +03:00
|
|
|
Syscalls/fallocate.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/fcntl.cpp
|
2023-01-25 18:19:30 +03:00
|
|
|
Syscalls/fork.cpp
|
2021-09-12 06:28:59 +03:00
|
|
|
Syscalls/fsync.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
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
|
2022-11-02 23:26:02 +03:00
|
|
|
Syscalls/jail.cpp
|
2021-01-30 23:35:54 +03:00
|
|
|
Syscalls/keymap.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/kill.cpp
|
|
|
|
Syscalls/link.cpp
|
|
|
|
Syscalls/lseek.cpp
|
|
|
|
Syscalls/mkdir.cpp
|
|
|
|
Syscalls/mknod.cpp
|
2023-01-25 18:15:35 +03:00
|
|
|
Syscalls/mmap.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/mount.cpp
|
|
|
|
Syscalls/open.cpp
|
|
|
|
Syscalls/perf_event.cpp
|
|
|
|
Syscalls/pipe.cpp
|
|
|
|
Syscalls/pledge.cpp
|
2021-12-12 12:44:37 +03:00
|
|
|
Syscalls/poll.cpp
|
2020-12-25 20:27:42 +03:00
|
|
|
Syscalls/prctl.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/process.cpp
|
|
|
|
Syscalls/profiling.cpp
|
2023-01-25 18:12:08 +03:00
|
|
|
Syscalls/ptrace.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/purge.cpp
|
|
|
|
Syscalls/read.cpp
|
|
|
|
Syscalls/readlink.cpp
|
|
|
|
Syscalls/realpath.cpp
|
|
|
|
Syscalls/rename.cpp
|
2022-02-01 00:09:30 +03:00
|
|
|
Syscalls/resource.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/rmdir.cpp
|
|
|
|
Syscalls/sched.cpp
|
|
|
|
Syscalls/sendfd.cpp
|
|
|
|
Syscalls/setpgid.cpp
|
|
|
|
Syscalls/setuid.cpp
|
2023-01-25 18:17:08 +03:00
|
|
|
Syscalls/sigaction.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/socket.cpp
|
|
|
|
Syscalls/stat.cpp
|
2021-05-19 12:31:43 +03:00
|
|
|
Syscalls/statvfs.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/sync.cpp
|
2023-02-24 23:18:34 +03:00
|
|
|
Syscalls/SyscallHandler.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/sysconf.cpp
|
|
|
|
Syscalls/thread.cpp
|
|
|
|
Syscalls/times.cpp
|
|
|
|
Syscalls/umask.cpp
|
|
|
|
Syscalls/uname.cpp
|
|
|
|
Syscalls/unlink.cpp
|
|
|
|
Syscalls/unveil.cpp
|
|
|
|
Syscalls/utime.cpp
|
2022-05-02 23:26:10 +03:00
|
|
|
Syscalls/utimensat.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/waitid.cpp
|
2021-05-12 22:17:51 +03:00
|
|
|
Syscalls/inode_watcher.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/write.cpp
|
2021-04-16 22:58:51 +03:00
|
|
|
TTY/ConsoleManagement.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
TTY/MasterPTY.cpp
|
|
|
|
TTY/PTYMultiplexer.cpp
|
|
|
|
TTY/SlavePTY.cpp
|
|
|
|
TTY/TTY.cpp
|
|
|
|
TTY/VirtualConsole.cpp
|
2023-02-24 21:00:03 +03:00
|
|
|
Tasks/Coredump.cpp
|
|
|
|
Tasks/CrashHandler.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Tasks/FinalizerTask.cpp
|
2023-02-24 20:45:37 +03:00
|
|
|
Tasks/FutexQueue.cpp
|
2023-02-24 21:25:52 +03:00
|
|
|
Tasks/PerformanceEventBuffer.cpp
|
2023-07-10 01:20:48 +03:00
|
|
|
Tasks/PowerStateSwitchTask.cpp
|
2023-02-24 20:45:37 +03:00
|
|
|
Tasks/Process.cpp
|
|
|
|
Tasks/ProcessGroup.cpp
|
|
|
|
Tasks/ProcessList.cpp
|
|
|
|
Tasks/Scheduler.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Tasks/SyncTask.cpp
|
2023-02-24 20:45:37 +03:00
|
|
|
Tasks/Thread.cpp
|
|
|
|
Tasks/ThreadBlockers.cpp
|
|
|
|
Tasks/ThreadTracer.cpp
|
|
|
|
Tasks/WaitQueue.cpp
|
|
|
|
Tasks/WorkQueue.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Time/TimeManagement.cpp
|
2023-02-24 21:23:38 +03:00
|
|
|
Time/TimerQueue.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
)
|
|
|
|
|
2022-10-04 03:05:54 +03:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
2021-10-15 22:55:22 +03:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
2022-08-23 22:25:36 +03:00
|
|
|
Arch/Processor.cpp
|
|
|
|
|
2022-10-04 13:46:11 +03:00
|
|
|
Arch/x86_64/CMOS.cpp
|
|
|
|
Arch/x86_64/DebugOutput.cpp
|
|
|
|
Arch/x86_64/Delay.cpp
|
|
|
|
|
2023-06-09 22:50:11 +03:00
|
|
|
Arch/x86_64/Firmware/ACPI/StaticParsing.cpp
|
2023-06-09 21:24:25 +03:00
|
|
|
Arch/x86_64/Firmware/MultiProcessor/Parser.cpp
|
2023-06-09 21:22:30 +03:00
|
|
|
Arch/x86_64/Firmware/PCBIOS/Mapper.cpp
|
|
|
|
Arch/x86_64/Firmware/PCBIOS/SysFSComponent.cpp
|
|
|
|
Arch/x86_64/Firmware/PCBIOS/SysFSDirectory.cpp
|
2023-06-09 22:50:11 +03:00
|
|
|
|
2022-10-04 13:46:11 +03:00
|
|
|
Arch/x86_64/Hypervisor/BochsDisplayConnector.cpp
|
|
|
|
Arch/x86_64/Hypervisor/VMWareBackdoor.cpp
|
|
|
|
|
|
|
|
Arch/x86_64/CurrentTime.cpp
|
|
|
|
|
2022-12-25 21:01:14 +03:00
|
|
|
Arch/x86_64/I8042Reboot.cpp
|
2022-10-04 13:46:11 +03:00
|
|
|
Arch/x86_64/Interrupts/APIC.cpp
|
|
|
|
Arch/x86_64/Interrupts/IOAPIC.cpp
|
|
|
|
Arch/x86_64/Interrupts/PIC.cpp
|
2022-12-25 21:01:14 +03:00
|
|
|
Arch/x86_64/Time/APICTimer.cpp
|
|
|
|
Arch/x86_64/Time/HPET.cpp
|
|
|
|
Arch/x86_64/Time/HPETComparator.cpp
|
|
|
|
Arch/x86_64/Time/PIT.cpp
|
|
|
|
Arch/x86_64/Time/RTC.cpp
|
|
|
|
Arch/x86_64/PCSpeaker.cpp
|
2022-10-04 13:46:11 +03:00
|
|
|
|
|
|
|
Arch/x86_64/ISABus/HID/VMWareMouseDevice.cpp
|
|
|
|
Arch/x86_64/ISABus/I8042Controller.cpp
|
|
|
|
Arch/x86_64/ISABus/IDEController.cpp
|
|
|
|
Arch/x86_64/ISABus/SerialDevice.cpp
|
|
|
|
Arch/x86_64/PCI/Controller/HostBridge.cpp
|
|
|
|
Arch/x86_64/PCI/IDELegacyModeController.cpp
|
|
|
|
Arch/x86_64/PCI/Initializer.cpp
|
2023-05-05 15:37:26 +03:00
|
|
|
Arch/x86_64/PCI/MSI.cpp
|
2022-10-04 13:46:11 +03:00
|
|
|
|
|
|
|
Arch/x86_64/VGA/IOArbiter.cpp
|
2022-10-25 19:55:42 +03:00
|
|
|
|
2023-06-09 22:13:04 +03:00
|
|
|
Arch/x86_64/PowerState.cpp
|
2022-12-25 21:01:14 +03:00
|
|
|
Arch/x86_64/RTC.cpp
|
|
|
|
Arch/x86_64/Shutdown.cpp
|
|
|
|
Arch/x86_64/SmapDisabler.cpp
|
|
|
|
|
2022-10-25 19:55:42 +03:00
|
|
|
# TODO: Share these with the aarch64 build
|
|
|
|
Interrupts/SpuriousInterruptHandler.cpp
|
2023-02-24 21:10:59 +03:00
|
|
|
kprintf.cpp
|
2021-10-15 22:55:22 +03:00
|
|
|
)
|
|
|
|
|
2021-08-27 22:23:43 +03:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
2022-10-04 13:46:11 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/Boot/ap_setup.S
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/InterruptEntry.cpp
|
2021-08-27 22:23:43 +03:00
|
|
|
)
|
2021-06-21 18:34:09 +03:00
|
|
|
|
2021-08-27 22:23:43 +03:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
2022-04-03 01:55:20 +03:00
|
|
|
|
2022-10-04 13:46:11 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/ASM_wrapper.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/CPU.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/CPUID.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/InterruptManagement.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/Interrupts.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/PageDirectory.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/Processor.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/ProcessorInfo.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/SafeMem.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/TrapFrame.cpp
|
2021-08-27 22:23:43 +03:00
|
|
|
)
|
2021-07-23 23:52:25 +03:00
|
|
|
|
|
|
|
if("${SERENITY_ARCH}" STREQUAL "x86_64")
|
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
2022-10-04 13:46:11 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/SyscallEntry.cpp
|
2021-07-23 23:52:25 +03:00
|
|
|
)
|
|
|
|
endif()
|
2022-10-25 19:55:42 +03:00
|
|
|
elseif("${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
set(RPI_SOURCES
|
|
|
|
Arch/aarch64/RPi/DebugOutput.cpp
|
|
|
|
Arch/aarch64/RPi/Framebuffer.cpp
|
|
|
|
Arch/aarch64/RPi/GPIO.cpp
|
|
|
|
Arch/aarch64/RPi/InterruptController.cpp
|
|
|
|
Arch/aarch64/RPi/Mailbox.cpp
|
2023-05-15 08:51:46 +03:00
|
|
|
Arch/aarch64/RPi/MiniUART.cpp
|
2023-03-16 12:54:29 +03:00
|
|
|
Arch/aarch64/RPi/SDHostController.cpp
|
2022-10-25 19:55:42 +03:00
|
|
|
Arch/aarch64/RPi/Timer.cpp
|
|
|
|
Arch/aarch64/RPi/UART.cpp
|
2023-05-15 08:34:19 +03:00
|
|
|
Arch/aarch64/RPi/Watchdog.cpp
|
2022-10-25 19:55:42 +03:00
|
|
|
)
|
2023-01-06 18:15:32 +03:00
|
|
|
set(SOURCES_RUNNING_WITHOUT_MMU
|
|
|
|
Arch/aarch64/Exceptions.cpp
|
|
|
|
Arch/aarch64/MMU.cpp
|
|
|
|
Arch/aarch64/pre_init.cpp
|
2023-05-27 10:42:19 +03:00
|
|
|
Arch/aarch64/RPi/MMIO.cpp
|
2023-01-06 18:15:32 +03:00
|
|
|
)
|
2022-10-25 19:55:42 +03:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
|
|
|
${RPI_SOURCES}
|
2023-01-06 18:15:32 +03:00
|
|
|
${SOURCES_RUNNING_WITHOUT_MMU}
|
2022-10-25 19:55:42 +03:00
|
|
|
Arch/Processor.cpp
|
|
|
|
|
2023-06-09 22:50:11 +03:00
|
|
|
Arch/aarch64/Firmware/ACPI/StaticParsing.cpp
|
|
|
|
|
2022-10-25 19:55:42 +03:00
|
|
|
Arch/aarch64/boot.S
|
|
|
|
Arch/aarch64/BootPPMParser.cpp
|
2023-01-02 02:25:19 +03:00
|
|
|
Arch/aarch64/CPUID.cpp
|
2022-10-25 19:55:42 +03:00
|
|
|
Arch/aarch64/CurrentTime.cpp
|
|
|
|
Arch/aarch64/Dummy.cpp
|
|
|
|
Arch/aarch64/InterruptManagement.cpp
|
|
|
|
Arch/aarch64/Interrupts.cpp
|
|
|
|
Arch/aarch64/kprintf.cpp
|
2023-02-17 20:35:32 +03:00
|
|
|
Arch/aarch64/MainIdRegister.cpp
|
2022-10-25 19:55:42 +03:00
|
|
|
Arch/aarch64/PageDirectory.cpp
|
|
|
|
Arch/aarch64/Panic.cpp
|
|
|
|
Arch/aarch64/Processor.cpp
|
2023-06-09 22:13:04 +03:00
|
|
|
Arch/aarch64/PowerState.cpp
|
2022-10-25 19:55:42 +03:00
|
|
|
Arch/aarch64/SafeMem.cpp
|
|
|
|
Arch/aarch64/SmapDisabler.cpp
|
2023-04-02 03:36:23 +03:00
|
|
|
Arch/aarch64/TrapFrame.cpp
|
2022-10-25 19:55:42 +03:00
|
|
|
Arch/aarch64/vector_table.S
|
|
|
|
)
|
|
|
|
|
|
|
|
# Otherwise linker errors e.g undefined reference to `__aarch64_cas8_acq_rel'
|
2023-08-11 13:31:20 +03:00
|
|
|
add_compile_options(-mno-outline-atomics)
|
2023-01-06 18:15:32 +03:00
|
|
|
|
|
|
|
# NOTE: These files cannot use a stack protector and sanitizers, as these will cause accesses to global variables to be inserted
|
|
|
|
# by the compiler. The CPU cannot access global variables without the MMU as the kernel is linked for a virtual address in high memory.
|
|
|
|
set_source_files_properties(${SOURCES_RUNNING_WITHOUT_MMU} PROPERTIES COMPILE_FLAGS "-fno-stack-protector -fno-sanitize=all")
|
2023-08-17 12:32:32 +03:00
|
|
|
elseif("${SERENITY_ARCH}" STREQUAL "riscv64")
|
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
|
|
|
Arch/Processor.cpp
|
|
|
|
kprintf.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
add_compile_options(-fno-stack-protector -fno-sanitize=all)
|
2021-08-27 22:23:43 +03:00
|
|
|
endif()
|
2021-03-07 23:28:28 +03:00
|
|
|
|
2020-05-06 18:40:06 +03:00
|
|
|
set(AK_SOURCES
|
2023-02-06 22:15:30 +03:00
|
|
|
../AK/DOSPackedTime.cpp
|
2020-08-09 12:34:26 +03:00
|
|
|
../AK/GenericLexer.cpp
|
2020-12-31 14:17:03 +03:00
|
|
|
../AK/Hex.cpp
|
2023-02-07 14:43:54 +03:00
|
|
|
../AK/MemoryStream.cpp
|
|
|
|
../AK/Stream.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
../AK/StringBuilder.cpp
|
|
|
|
../AK/StringUtils.cpp
|
|
|
|
../AK/StringView.cpp
|
2020-08-26 02:19:16 +03:00
|
|
|
../AK/Time.cpp
|
2023-02-05 13:27:38 +03:00
|
|
|
../AK/Error.cpp
|
2020-09-22 14:05:40 +03:00
|
|
|
../AK/Format.cpp
|
2020-12-31 14:17:03 +03:00
|
|
|
../AK/UUID.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
)
|
|
|
|
|
2022-01-01 08:02:55 +03:00
|
|
|
set(EDID_SOURCES
|
|
|
|
../Userland/Libraries/LibEDID/DMT.cpp
|
|
|
|
../Userland/Libraries/LibEDID/EDID.cpp
|
|
|
|
../Userland/Libraries/LibEDID/VIC.cpp
|
|
|
|
)
|
|
|
|
|
2020-05-06 18:40:06 +03:00
|
|
|
set(ELF_SOURCES
|
2021-01-12 14:17:30 +03:00
|
|
|
../Userland/Libraries/LibELF/Image.cpp
|
|
|
|
../Userland/Libraries/LibELF/Validation.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
)
|
|
|
|
|
2022-08-30 13:44:33 +03:00
|
|
|
add_custom_command(
|
|
|
|
COMMAND "${SerenityOS_SOURCE_DIR}/Kernel/generate-version-file.sh" "${CMAKE_CURRENT_BINARY_DIR}/Version.h.tmp"
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_BINARY_DIR}/Version.h.tmp" "${CMAKE_CURRENT_BINARY_DIR}/Version.h"
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E remove "${CMAKE_CURRENT_BINARY_DIR}/Version.h.tmp"
|
|
|
|
WORKING_DIRECTORY "${SerenityOS_SOURCE_DIR}"
|
|
|
|
COMMENT "Generating SerenityOS version information"
|
|
|
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Version.h"
|
|
|
|
VERBATIM
|
|
|
|
)
|
2022-10-17 08:42:18 +03:00
|
|
|
add_custom_target(generate_version_header DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/Version.h")
|
2022-08-30 13:44:33 +03:00
|
|
|
set(GENERATED_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/Version.h")
|
|
|
|
|
2021-05-08 21:37:43 +03:00
|
|
|
generate_state_machine(../Userland/Libraries/LibVT/StateMachine.txt ../Userland/Libraries/LibVT/EscapeSequenceStateMachine.h)
|
|
|
|
|
2020-05-27 00:35:14 +03:00
|
|
|
set(VT_SOURCES
|
2021-01-12 14:17:30 +03:00
|
|
|
../Userland/Libraries/LibVT/Terminal.cpp
|
|
|
|
../Userland/Libraries/LibVT/Line.cpp
|
2021-05-08 21:37:43 +03:00
|
|
|
../Userland/Libraries/LibVT/EscapeSequenceParser.cpp
|
2020-05-27 00:35:14 +03:00
|
|
|
)
|
|
|
|
|
2020-06-23 05:23:35 +03:00
|
|
|
set(CRYPTO_SOURCES
|
2021-01-12 14:17:30 +03:00
|
|
|
../Userland/Libraries/LibCrypto/Cipher/AES.cpp
|
|
|
|
../Userland/Libraries/LibCrypto/Hash/SHA2.cpp
|
2020-06-23 05:23:35 +03:00
|
|
|
)
|
|
|
|
|
2022-02-12 22:21:28 +03:00
|
|
|
set(PARTITION_SOURCES
|
|
|
|
../Userland/Libraries/LibPartition/DiskPartitionMetadata.cpp
|
2022-03-02 04:01:52 +03:00
|
|
|
../Userland/Libraries/LibPartition/EBRPartitionTable.cpp
|
2022-03-02 04:21:35 +03:00
|
|
|
../Userland/Libraries/LibPartition/GUIDPartitionTable.cpp
|
2022-03-02 03:42:06 +03:00
|
|
|
../Userland/Libraries/LibPartition/MBRPartitionTable.cpp
|
2023-05-21 21:33:09 +03:00
|
|
|
../Userland/Libraries/LibPartition/PartitionableDevice.cpp
|
2022-03-02 02:09:46 +03:00
|
|
|
../Userland/Libraries/LibPartition/PartitionTable.cpp
|
2022-02-12 22:21:28 +03:00
|
|
|
)
|
|
|
|
|
2021-10-15 16:57:42 +03:00
|
|
|
set(SOURCES
|
2022-10-25 19:55:42 +03:00
|
|
|
${KERNEL_SOURCES}
|
|
|
|
${GENERATED_SOURCES}
|
2021-10-15 16:57:42 +03:00
|
|
|
${AK_SOURCES}
|
2022-10-25 19:55:42 +03:00
|
|
|
${EDID_SOURCES}
|
|
|
|
${ELF_SOURCES}
|
|
|
|
${VT_SOURCES}
|
|
|
|
${CRYPTO_SOURCES}
|
|
|
|
${PARTITION_SOURCES}
|
|
|
|
)
|
2020-05-06 18:40:06 +03:00
|
|
|
|
2021-10-14 02:04:04 +03:00
|
|
|
add_compile_options(-fsigned-char)
|
2021-09-07 11:21:36 +03:00
|
|
|
add_compile_options(-Wno-unknown-warning-option -Wvla -Wnull-dereference)
|
|
|
|
add_compile_options(-fno-rtti -ffreestanding -fbuiltin)
|
2022-05-14 14:50:07 +03:00
|
|
|
|
2022-10-04 03:05:54 +03:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
2021-09-07 11:21:36 +03:00
|
|
|
add_compile_options(-mno-80387 -mno-mmx -mno-sse -mno-sse2)
|
2022-05-14 14:50:07 +03:00
|
|
|
elseif("${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
add_compile_options(-mgeneral-regs-only)
|
2021-08-27 22:23:43 +03:00
|
|
|
endif()
|
2022-05-14 14:50:07 +03:00
|
|
|
|
2021-09-07 11:21:36 +03:00
|
|
|
add_compile_options(-fno-asynchronous-unwind-tables)
|
|
|
|
add_compile_options(-fstack-protector-strong)
|
|
|
|
add_compile_options(-fno-exceptions)
|
2022-10-13 08:38:20 +03:00
|
|
|
add_compile_options(-nostdlib)
|
2020-05-06 18:40:06 +03:00
|
|
|
|
2022-06-24 10:34:38 +03:00
|
|
|
# Auto initialize trivial types on the stack, we use "pattern" as
|
|
|
|
# it's the only option portable across compilers going forward.
|
|
|
|
#
|
|
|
|
# This is designed to help avoid uninitialized variables bugs and
|
|
|
|
# information disclosures coming from the kernel stack.
|
|
|
|
#
|
|
|
|
# FIXME: It appears to conflict with something during the boot of the
|
|
|
|
# aarch64 kernel, we should investigate and remove this special case.
|
|
|
|
if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
add_compile_options(-ftrivial-auto-var-init=pattern)
|
|
|
|
endif()
|
|
|
|
|
2021-09-07 11:21:36 +03:00
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
|
|
# Apply any flags that are only available on >= GCC 11.1
|
|
|
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11.1")
|
|
|
|
# Zero any registers used within a function on return (to reduce data lifetime and ROP gadgets).
|
|
|
|
add_compile_options(-fzero-call-used-regs=used-gpr)
|
|
|
|
endif()
|
|
|
|
link_directories(${TOOLCHAIN_ROOT}/${SERENITY_ARCH}-pc-serenity/lib)
|
|
|
|
link_directories(${TOOLCHAIN_ROOT}/lib/gcc/${SERENITY_ARCH}-pc-serenity/${GCC_VERSION}/)
|
Toolchain+Meta: Update LLVM version to 13.0.0
This commit updates the Clang toolchain's version to 13.0.0, which comes
with better C++20 support and improved handling of new features by
clang-format. Due to the newly enabled `-Bsymbolic-functions` flag, our
Clang binaries will only be 2-4% slower than if we dynamically linked
them, but we save hundreds of megabytes of disk space.
The `BuildClang.sh` script has been reworked to build the entire
toolchain in just three steps: one for the compiler, one for GNU
binutils, and one for the runtime libraries. This reduces the complexity
of the build script, and will allow us to modify the CI configuration to
only rebuild the libraries when our libc headers change.
Most of the compile flags have been moved out to a separate CMake cache
file, similarly to how the Android and Fuchsia toolchains are
implemented within the LLVM repo. This provides a nicer interface than
the heaps of command-line arguments.
We no longer build separate toolchains for each architecture, as the
same Clang binary can compile code for multiple targets.
The horrible mess that `SERENITY_CLANG_ARCH` was, has been removed in
this commit. Clang happily accepts an `i686-pc-serenity` target triple,
which matches what our GCC toolchain accepts.
2021-08-13 13:11:12 +03:00
|
|
|
|
|
|
|
set(TARGET_STRING "")
|
2022-02-05 17:48:32 +03:00
|
|
|
|
2022-05-07 19:11:00 +03:00
|
|
|
|
|
|
|
# Prevent naively implemented string functions (like strlen) from being "optimized" into a call to themselves.
|
2023-02-24 21:10:59 +03:00
|
|
|
set_source_files_properties(Library/MiniStdLib.cpp
|
2022-05-07 19:11:00 +03:00
|
|
|
PROPERTIES COMPILE_FLAGS "-fno-tree-loop-distribution -fno-tree-loop-distribute-patterns")
|
|
|
|
|
2023-08-11 13:55:45 +03:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
|
|
|
# The BFD linker only supports RELR relocations on x86 and POWER.
|
|
|
|
add_link_options(LINKER:-z,pack-relative-relocs)
|
|
|
|
endif()
|
2021-09-07 11:21:36 +03:00
|
|
|
else() # Assume Clang
|
Kernel: Fix UB caused by taking a reference to a packed struct's member
Taking a reference or a pointer to a value that's not aligned properly
is undefined behavior. While `[[gnu::packed]]` ensures that reads from
and writes to fields of packed structs is a safe operation, the
information about the reduced alignment is lost when creating pointers
to these values.
Weirdly enough, GCC's undefined behavior sanitizer doesn't flag these,
even though the doc of `-Waddress-of-packed-member` says that it usually
leads to UB. In contrast, x86_64 Clang does flag these, which renders
the 64-bit kernel unable to boot.
For now, the `address-of-packed-member` warning will only be enabled in
the kernel, as it is absolutely crucial there because of KUBSAN, but
might get excessively noisy for the userland in the future.
Also note that we can't append to `CMAKE_CXX_FLAGS` like we do for other
flags in the kernel, because flags added via `add_compile_options` come
after these, so the `-Wno-address-of-packed-member` in the root would
cancel it out.
2021-08-01 21:30:43 +03:00
|
|
|
add_compile_options(-Waddress-of-packed-member)
|
2021-09-07 11:21:36 +03:00
|
|
|
add_compile_options(-faligned-allocation)
|
Toolchain+Meta: Update LLVM version to 13.0.0
This commit updates the Clang toolchain's version to 13.0.0, which comes
with better C++20 support and improved handling of new features by
clang-format. Due to the newly enabled `-Bsymbolic-functions` flag, our
Clang binaries will only be 2-4% slower than if we dynamically linked
them, but we save hundreds of megabytes of disk space.
The `BuildClang.sh` script has been reworked to build the entire
toolchain in just three steps: one for the compiler, one for GNU
binutils, and one for the runtime libraries. This reduces the complexity
of the build script, and will allow us to modify the CI configuration to
only rebuild the libraries when our libc headers change.
Most of the compile flags have been moved out to a separate CMake cache
file, similarly to how the Android and Fuchsia toolchains are
implemented within the LLVM repo. This provides a nicer interface than
the heaps of command-line arguments.
We no longer build separate toolchains for each architecture, as the
same Clang binary can compile code for multiple targets.
The horrible mess that `SERENITY_CLANG_ARCH` was, has been removed in
this commit. Clang happily accepts an `i686-pc-serenity` target triple,
which matches what our GCC toolchain accepts.
2021-08-13 13:11:12 +03:00
|
|
|
|
|
|
|
# We need this in order to pick up the #define __serenity__, otherwise we end up including unistd.h into the linker script
|
|
|
|
set(TARGET_STRING "--target=${CMAKE_CXX_COMPILER_TARGET}")
|
2022-02-01 00:09:30 +03:00
|
|
|
|
2022-02-05 17:48:32 +03:00
|
|
|
add_link_options(LINKER:--build-id=none LINKER:--pack-dyn-relocs=relr)
|
2021-07-13 17:43:45 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
macro (set_new_alignment alignment)
|
2021-09-07 11:21:36 +03:00
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
2021-07-13 17:43:45 +03:00
|
|
|
add_compile_options(-faligned-new=${alignment})
|
2021-09-07 11:21:36 +03:00
|
|
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
|
|
|
|
add_compile_options(-fnew-alignment=${alignment})
|
2021-07-13 17:43:45 +03:00
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2021-03-04 19:50:05 +03:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
2021-09-07 11:21:36 +03:00
|
|
|
add_compile_options(-mcmodel=large -mno-red-zone)
|
2021-07-13 17:43:45 +03:00
|
|
|
set_new_alignment(8)
|
2021-03-04 19:50:05 +03:00
|
|
|
endif()
|
|
|
|
|
2021-07-26 16:10:51 +03:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-pie")
|
2021-07-23 13:56:35 +03:00
|
|
|
|
2021-06-07 02:15:07 +03:00
|
|
|
# Kernel Coverage (KCOV) is an API to collect and expose program counters of
|
|
|
|
# kernel code that has been run to user space. It's rather slow and likely not
|
|
|
|
# secure to run in production builds. Useful for coverage guided fuzzing.
|
|
|
|
if (ENABLE_KERNEL_COVERAGE_COLLECTION)
|
|
|
|
add_definitions(-DENABLE_KERNEL_COVERAGE_COLLECTION)
|
2021-08-25 06:28:51 +03:00
|
|
|
add_compile_options(-fsanitize-coverage=trace-pc)
|
2021-06-07 02:15:07 +03:00
|
|
|
set(KCOV_EXCLUDED_SOURCES
|
|
|
|
# Make sure we don't instrument any code called from __sanitizer_cov_trace_pc
|
|
|
|
# otherwise we'll end up with recursive calls to that function.
|
2023-02-05 13:27:38 +03:00
|
|
|
../AK/Error.cpp
|
2021-06-07 02:15:07 +03:00
|
|
|
../AK/Format.cpp
|
|
|
|
../AK/StringBuilder.cpp
|
2022-10-04 13:46:11 +03:00
|
|
|
../Kernel/Arch/x86_64/Processor.cpp
|
2021-06-07 02:15:07 +03:00
|
|
|
../Kernel/Devices/KCOVDevice.cpp
|
|
|
|
../Kernel/Devices/KCOVInstance.cpp
|
|
|
|
../Kernel/FileSystem/File.cpp
|
2021-09-07 14:39:11 +03:00
|
|
|
../Kernel/FileSystem/OpenFileDescription.cpp
|
2021-06-07 02:15:07 +03:00
|
|
|
../Kernel/init.cpp
|
|
|
|
../Kernel/SanCov.cpp
|
|
|
|
# GCC assumes that the caller saves registers for functions according
|
|
|
|
# to the System V ABI and happily inserts coverage calls into the
|
|
|
|
# function prologue for all functions. This assumption is not true for
|
|
|
|
# interrupt handlers because their calling convention is not compatible
|
|
|
|
# with the System V ABI.
|
2022-10-04 13:46:11 +03:00
|
|
|
../Kernel/Arch/x86_64/Interrupts.cpp
|
2023-02-24 23:18:34 +03:00
|
|
|
../Kernel/Syscall/SyscallHandler.cpp
|
2021-06-07 02:15:07 +03:00
|
|
|
)
|
|
|
|
set_source_files_properties(${KCOV_EXCLUDED_SOURCES} PROPERTIES COMPILE_FLAGS "-fno-sanitize-coverage=trace-pc")
|
2022-03-05 04:05:24 +03:00
|
|
|
elseif (ENABLE_USERSPACE_COVERAGE_COLLECTION)
|
|
|
|
# Disable checking open() pledges and the veil for coverage data when building userspace with coverage
|
|
|
|
# so that binaries can write out coverage data even with pledges/veil
|
|
|
|
add_compile_definitions(SKIP_PATH_VALIDATION_FOR_COVERAGE_INSTRUMENTATION)
|
2021-06-07 02:15:07 +03:00
|
|
|
endif()
|
|
|
|
|
2022-05-11 11:31:16 +03:00
|
|
|
if (ENABLE_KERNEL_UNDEFINED_SANITIZER)
|
|
|
|
# Kernel Undefined Behavior Sanitizer (KUBSAN)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
|
|
|
|
endif()
|
2021-02-24 22:47:56 +03:00
|
|
|
|
2021-02-14 23:47:10 +03: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)
|
2021-08-25 06:28:51 +03:00
|
|
|
add_compile_options(-fsanitize=kernel-address)
|
2021-09-07 11:21:36 +03:00
|
|
|
add_link_options(-fsanitize=kernel-address)
|
2021-02-14 23:47:10 +03:00
|
|
|
endif()
|
|
|
|
|
2022-03-08 20:21:40 +03:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
add_compile_options(-fno-threadsafe-statics)
|
2022-12-20 21:49:35 +03:00
|
|
|
|
|
|
|
# Unaligned memory access will cause a trap, so to make sure the compiler doesn't generate
|
|
|
|
# those unaligned accesses, this flag is added.
|
|
|
|
add_compile_options(-mstrict-align -Wno-cast-align)
|
2022-03-08 20:21:40 +03:00
|
|
|
endif()
|
|
|
|
|
2021-02-11 23:20:10 +03:00
|
|
|
add_compile_definitions(KERNEL)
|
2021-08-18 18:39:04 +03:00
|
|
|
add_link_options(LINKER:-z,notext)
|
|
|
|
|
2022-05-09 12:24:03 +03:00
|
|
|
add_library(kernel_heap STATIC ${KERNEL_HEAP_SOURCES})
|
2023-04-28 21:55:59 +03:00
|
|
|
add_dependencies(kernel_heap install_libc_headers)
|
2022-05-09 12:24:03 +03:00
|
|
|
|
2021-07-18 15:47:32 +03:00
|
|
|
add_executable(Kernel ${SOURCES})
|
2023-04-28 21:55:59 +03:00
|
|
|
add_dependencies(Kernel generate_EscapeSequenceStateMachine.h generate_version_header install_libc_headers)
|
2021-05-20 12:44:23 +03:00
|
|
|
|
2022-03-08 20:21:40 +03:00
|
|
|
if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/linker.ld
|
2022-10-04 13:46:11 +03:00
|
|
|
COMMAND "${CMAKE_CXX_COMPILER}" ${TARGET_STRING} -E -P -x c -I${CMAKE_CURRENT_SOURCE_DIR}/.. "${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/linker.ld" -o "${CMAKE_CURRENT_BINARY_DIR}/linker.ld"
|
|
|
|
MAIN_DEPENDENCY "Arch/x86_64/linker.ld"
|
2022-03-08 20:21:40 +03:00
|
|
|
COMMENT "Preprocessing linker.ld"
|
|
|
|
VERBATIM
|
|
|
|
)
|
|
|
|
add_custom_target(generate_kernel_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/linker.ld)
|
|
|
|
target_link_options(Kernel PRIVATE LINKER:-T ${CMAKE_CURRENT_BINARY_DIR}/linker.ld -nostdlib -nodefaultlibs)
|
|
|
|
set_target_properties(Kernel PROPERTIES LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/linker.ld")
|
2023-06-16 01:05:09 +03:00
|
|
|
|
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
|
|
target_compile_options(Kernel PRIVATE -mpreferred-stack-boundary=3)
|
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
|
|
|
|
target_compile_options(Kernel PRIVATE -mstack-alignment=8)
|
|
|
|
endif()
|
2022-03-08 20:21:40 +03:00
|
|
|
else()
|
|
|
|
target_link_options(Kernel PRIVATE LINKER:-T ${CMAKE_CURRENT_SOURCE_DIR}/Arch/aarch64/linker.ld -nostdlib LINKER:--no-pie)
|
|
|
|
set_target_properties(Kernel PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Arch/aarch64/linker.ld)
|
|
|
|
endif()
|
2021-06-17 20:26:37 +03:00
|
|
|
|
2021-04-29 16:25:31 +03:00
|
|
|
if (ENABLE_KERNEL_LTO)
|
|
|
|
include(CheckIPOSupported)
|
|
|
|
check_ipo_supported()
|
2021-10-09 20:05:19 +03:00
|
|
|
add_definitions(-DENABLE_KERNEL_LTO)
|
2021-07-18 15:47:32 +03:00
|
|
|
set_property(TARGET Kernel PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
2021-09-21 23:59:03 +03:00
|
|
|
if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
set_property(TARGET kernel_heap PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
|
|
|
endif()
|
2021-04-29 16:25:31 +03:00
|
|
|
endif()
|
2021-07-13 17:43:45 +03:00
|
|
|
|
2022-05-09 12:24:03 +03:00
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
|
|
target_link_libraries(Kernel PRIVATE kernel_heap gcc)
|
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
|
|
|
|
target_link_libraries(Kernel PRIVATE kernel_heap clang_rt.builtins)
|
2021-07-13 17:43:45 +03:00
|
|
|
endif()
|
|
|
|
|
2023-04-28 18:27:24 +03:00
|
|
|
add_custom_command(
|
2022-03-08 20:21:40 +03:00
|
|
|
TARGET Kernel POST_BUILD
|
2022-09-02 21:59:45 +03:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E env NM=${CMAKE_NM} sh ${CMAKE_CURRENT_SOURCE_DIR}/mkmap.sh
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -E env OBJCOPY=${CMAKE_OBJCOPY} sh ${CMAKE_CURRENT_SOURCE_DIR}/embedmap.sh
|
2022-03-08 20:21:40 +03:00
|
|
|
COMMAND ${CMAKE_OBJCOPY} --only-keep-debug Kernel Kernel.debug
|
|
|
|
COMMAND ${CMAKE_OBJCOPY} --strip-debug Kernel
|
|
|
|
COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=Kernel.debug Kernel
|
|
|
|
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/kernel.map
|
2023-04-28 18:27:24 +03:00
|
|
|
)
|
2021-06-24 14:08:19 +03:00
|
|
|
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Kernel" DESTINATION boot)
|
2021-07-17 10:43:15 +03:00
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Kernel.debug" DESTINATION boot)
|
2021-07-14 22:04:18 +03:00
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kernel.map" DESTINATION res)
|
2020-05-06 18:40:06 +03:00
|
|
|
|
2023-05-16 09:58:34 +03:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
add_custom_command(
|
|
|
|
TARGET Kernel POST_BUILD
|
|
|
|
COMMAND ${CMAKE_OBJCOPY} -O binary Kernel kernel8.img
|
|
|
|
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/kernel8.img
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-05-26 21:20:24 +03:00
|
|
|
serenity_install_headers(Kernel)
|
2020-08-15 15:11:10 +03:00
|
|
|
serenity_install_sources(Kernel)
|
2020-05-26 21:20:24 +03:00
|
|
|
|
2023-08-17 12:32:32 +03:00
|
|
|
# Only x86 needs a Prekernel
|
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
2022-03-08 20:21:40 +03:00
|
|
|
add_subdirectory(Prekernel)
|
|
|
|
endif()
|