2021-05-23 20:20:22 +00:00
|
|
|
if (ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS)
|
|
|
|
add_compile_options(-Og)
|
|
|
|
add_compile_options(-ggdb3)
|
|
|
|
else()
|
2021-12-14 08:42:26 +00:00
|
|
|
add_compile_options(-O2)
|
2021-05-23 20:20:22 +00:00
|
|
|
endif()
|
2021-02-24 10:30:19 +00:00
|
|
|
|
2021-08-27 19:23:43 +00:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
set(KERNEL_ARCH aarch64)
|
2021-03-04 16:50:05 +00:00
|
|
|
elseif("${SERENITY_ARCH}" STREQUAL "x86_64")
|
|
|
|
set(KERNEL_ARCH x86_64)
|
2023-08-17 09:32:32 +00:00
|
|
|
elseif("${SERENITY_ARCH}" STREQUAL "riscv64")
|
|
|
|
set(KERNEL_ARCH riscv64)
|
2021-03-04 16:50:05 +00:00
|
|
|
endif()
|
|
|
|
|
2020-08-10 15:44:35 +00:00
|
|
|
set(KERNEL_HEAP_SOURCES
|
|
|
|
Heap/kmalloc.cpp
|
|
|
|
)
|
|
|
|
|
2020-05-06 15:40:06 +00:00
|
|
|
set(KERNEL_SOURCES
|
2023-04-01 00:10:19 +00:00
|
|
|
Arch/init.cpp
|
2023-02-22 22:32:00 +00:00
|
|
|
Arch/DeferredCallPool.cpp
|
2023-09-18 19:45:14 +00:00
|
|
|
Arch/PageFault.cpp
|
|
|
|
Arch/Processor.cpp
|
|
|
|
Arch/TrapFrame.cpp
|
2023-02-24 18:21:53 +00:00
|
|
|
Boot/CommandLine.cpp
|
2022-09-02 10:41:48 +00:00
|
|
|
Bus/PCI/Controller/HostController.cpp
|
2022-01-07 12:10:44 +00:00
|
|
|
Bus/PCI/Controller/MemoryBackedHostBridge.cpp
|
2022-01-15 07:17:07 +00:00
|
|
|
Bus/PCI/Controller/VolumeManagementDevice.cpp
|
2021-06-25 06:46:17 +00: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 09:08:38 +00:00
|
|
|
Bus/PCI/API.cpp
|
2021-08-21 03:58:43 +00: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 16:33:13 +00:00
|
|
|
Bus/PCI/DeviceIdentifier.cpp
|
2021-08-13 06:10:43 +00:00
|
|
|
Bus/USB/UHCI/UHCIController.cpp
|
|
|
|
Bus/USB/UHCI/UHCIRootHub.cpp
|
2023-05-05 06:05:04 +00:00
|
|
|
Bus/USB/Drivers/HID/MouseDriver.cpp
|
2023-09-15 19:15:30 +00:00
|
|
|
Bus/USB/Drivers/MassStorage/MassStorageDriver.cpp
|
2022-04-14 15:11:15 +00:00
|
|
|
Bus/USB/USBConfiguration.cpp
|
2021-08-08 18:50:20 +00:00
|
|
|
Bus/USB/USBController.cpp
|
2021-06-25 06:51:22 +00:00
|
|
|
Bus/USB/USBDevice.cpp
|
2021-08-13 19:47:13 +00:00
|
|
|
Bus/USB/USBHub.cpp
|
2021-08-08 18:50:20 +00:00
|
|
|
Bus/USB/USBManagement.cpp
|
2021-06-25 06:51:22 +00:00
|
|
|
Bus/USB/USBPipe.cpp
|
|
|
|
Bus/USB/USBTransfer.cpp
|
2023-06-10 11:46:47 +00:00
|
|
|
Bus/VirtIO/Transport/PCIe/Detect.cpp
|
|
|
|
Bus/VirtIO/Transport/PCIe/InterruptHandler.cpp
|
|
|
|
Bus/VirtIO/Transport/PCIe/TransportLink.cpp
|
|
|
|
Bus/VirtIO/Transport/Entity.cpp
|
|
|
|
Bus/VirtIO/Transport/InterruptHandler.cpp
|
2021-08-27 09:24:50 +00:00
|
|
|
Bus/VirtIO/Console.cpp
|
|
|
|
Bus/VirtIO/ConsolePort.cpp
|
|
|
|
Bus/VirtIO/Device.cpp
|
|
|
|
Bus/VirtIO/Queue.cpp
|
|
|
|
Bus/VirtIO/RNG.cpp
|
2020-11-02 18:16:01 +00:00
|
|
|
Devices/AsyncDeviceRequest.cpp
|
2023-06-19 19:12:45 +00:00
|
|
|
Devices/Audio/AC97/AC97.cpp
|
2022-02-11 19:47:45 +00:00
|
|
|
Devices/Audio/Channel.cpp
|
2023-03-10 19:10:06 +00:00
|
|
|
Devices/Audio/IntelHDA/Codec.cpp
|
|
|
|
Devices/Audio/IntelHDA/Controller.cpp
|
|
|
|
Devices/Audio/IntelHDA/Format.cpp
|
2023-07-04 09:18:05 +00:00
|
|
|
Devices/Audio/IntelHDA/InterruptHandler.cpp
|
2023-03-10 19:10:06 +00:00
|
|
|
Devices/Audio/IntelHDA/Stream.cpp
|
2022-02-11 19:47:45 +00:00
|
|
|
Devices/Audio/Management.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
|
2021-09-11 06:19:20 +00:00
|
|
|
Devices/DeviceManagement.cpp
|
2021-06-06 23:15:07 +00:00
|
|
|
Devices/KCOVDevice.cpp
|
|
|
|
Devices/KCOVInstance.cpp
|
2021-04-23 14:26:52 +00:00
|
|
|
Devices/PCISerialDevice.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Devices/SerialDevice.cpp
|
2021-04-02 20:21:35 +00:00
|
|
|
Devices/HID/KeyboardDevice.cpp
|
2022-12-19 21:53:51 +00:00
|
|
|
Devices/HID/Management.cpp
|
2021-04-02 20:21:35 +00:00
|
|
|
Devices/HID/MouseDevice.cpp
|
2023-05-12 15:04:01 +00:00
|
|
|
Devices/HID/PS2/KeyboardDevice.cpp
|
|
|
|
Devices/HID/PS2/MouseDevice.cpp
|
2023-05-05 06:05:04 +00:00
|
|
|
Devices/HID/USB/MouseDevice.cpp
|
2023-03-18 11:17:13 +00:00
|
|
|
Devices/Generic/ConsoleDevice.cpp
|
|
|
|
Devices/Generic/DeviceControlDevice.cpp
|
|
|
|
Devices/Generic/FullDevice.cpp
|
|
|
|
Devices/Generic/MemoryDevice.cpp
|
|
|
|
Devices/Generic/NullDevice.cpp
|
2023-08-25 16:48:46 +00:00
|
|
|
Devices/Generic/PCSpeakerDevice.cpp
|
2023-03-18 11:17:13 +00:00
|
|
|
Devices/Generic/RandomDevice.cpp
|
|
|
|
Devices/Generic/SelfTTYDevice.cpp
|
|
|
|
Devices/Generic/ZeroDevice.cpp
|
2023-08-24 15:05:42 +00:00
|
|
|
Devices/GPU/3dfx/GraphicsAdapter.cpp
|
|
|
|
Devices/GPU/3dfx/VoodooDisplayConnector.cpp
|
2023-06-03 11:47:47 +00: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 11:32:12 +00: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
|
2023-09-15 19:15:30 +00:00
|
|
|
Devices/Storage/USB/BulkSCSIInterface.cpp
|
2023-03-18 11:32:12 +00:00
|
|
|
Devices/Storage/DiskPartition.cpp
|
|
|
|
Devices/Storage/StorageController.cpp
|
|
|
|
Devices/Storage/StorageDevice.cpp
|
|
|
|
Devices/Storage/StorageManagement.cpp
|
2021-06-06 23:15:07 +00:00
|
|
|
SanCov.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
|
2022-10-24 07:38:41 +00:00
|
|
|
FileSystem/DevPtsFS/FileSystem.cpp
|
|
|
|
FileSystem/DevPtsFS/Inode.cpp
|
2022-10-24 07:02:37 +00:00
|
|
|
FileSystem/Ext2FS/FileSystem.cpp
|
|
|
|
FileSystem/Ext2FS/Inode.cpp
|
2022-10-24 05:25:16 +00:00
|
|
|
FileSystem/FATFS/FileSystem.cpp
|
|
|
|
FileSystem/FATFS/Inode.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
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/FileSystem.cpp
|
|
|
|
FileSystem/Inode.cpp
|
|
|
|
FileSystem/InodeFile.cpp
|
2022-08-19 20:20:43 +00:00
|
|
|
FileSystem/InodeMetadata.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
FileSystem/InodeWatcher.cpp
|
2022-10-24 08:02:50 +00:00
|
|
|
FileSystem/ISO9660FS/DirectoryIterator.cpp
|
|
|
|
FileSystem/ISO9660FS/FileSystem.cpp
|
|
|
|
FileSystem/ISO9660FS/Inode.cpp
|
2021-07-10 22:46:06 +00:00
|
|
|
FileSystem/Mount.cpp
|
2022-12-15 09:42:40 +00:00
|
|
|
FileSystem/MountFile.cpp
|
2021-09-07 11:39:11 +00:00
|
|
|
FileSystem/OpenFileDescription.cpp
|
2022-10-24 07:28:24 +00:00
|
|
|
FileSystem/Plan9FS/FileSystem.cpp
|
|
|
|
FileSystem/Plan9FS/Inode.cpp
|
|
|
|
FileSystem/Plan9FS/Message.cpp
|
2022-10-24 06:41:31 +00:00
|
|
|
FileSystem/ProcFS/FileSystem.cpp
|
|
|
|
FileSystem/ProcFS/Inode.cpp
|
2023-02-20 15:51:18 +00: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 17:00:54 +00:00
|
|
|
FileSystem/RAMFS/FileSystem.cpp
|
|
|
|
FileSystem/RAMFS/Inode.cpp
|
2022-04-22 06:44:31 +00:00
|
|
|
FileSystem/SysFS/Component.cpp
|
2022-10-23 18:51:56 +00:00
|
|
|
FileSystem/SysFS/DirectoryInode.cpp
|
|
|
|
FileSystem/SysFS/FileSystem.cpp
|
|
|
|
FileSystem/SysFS/Inode.cpp
|
|
|
|
FileSystem/SysFS/LinkInode.cpp
|
2022-04-22 09:46:19 +00:00
|
|
|
FileSystem/SysFS/Registry.cpp
|
|
|
|
FileSystem/SysFS/RootDirectory.cpp
|
2022-04-22 07:17:13 +00: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 18:35:30 +00:00
|
|
|
FileSystem/SysFS/Subsystems/Bus/PCI/DeviceExpansionROM.cpp
|
2022-04-22 07:04:37 +00:00
|
|
|
FileSystem/SysFS/Subsystems/Bus/USB/BusDirectory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Bus/USB/DeviceInformation.cpp
|
2022-04-22 09:46:19 +00:00
|
|
|
FileSystem/SysFS/Subsystems/Bus/Directory.cpp
|
2022-04-22 12:51:45 +00: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 08:48:40 +00: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 05:08:53 +00: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 08:48:40 +00:00
|
|
|
FileSystem/SysFS/Subsystems/Devices/Directory.cpp
|
2022-04-22 06:44:31 +00:00
|
|
|
FileSystem/SysFS/Subsystems/Firmware/Directory.cpp
|
2022-10-14 17:51:51 +00:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Interrupts.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Processes.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/CPUInfo.cpp
|
2023-08-12 11:06:35 +00:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/ConstantInformation.cpp
|
2022-11-02 20:26:02 +00:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Jails.cpp
|
2022-10-14 17:51:51 +00: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 02:57:20 +00:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/PowerStateSwitch.cpp
|
2022-10-14 17:51:51 +00: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-08-12 10:57:13 +00:00
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Configuration/BooleanVariable.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Configuration/CapsLockRemap.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Configuration/CoredumpDirectory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Configuration/Directory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Configuration/DumpKmallocStack.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Configuration/StringVariable.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Kernel/Configuration/UBSANDeadly.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
FileSystem/VirtualFileSystem.cpp
|
2021-09-11 07:39:47 +00:00
|
|
|
Firmware/ACPI/Initialize.cpp
|
|
|
|
Firmware/ACPI/Parser.cpp
|
2023-06-09 19:50:11 +00:00
|
|
|
Firmware/ACPI/StaticParsing.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Interrupts/GenericInterruptHandler.cpp
|
|
|
|
Interrupts/IRQHandler.cpp
|
2023-04-29 19:50:01 +00:00
|
|
|
Interrupts/PCIIRQHandler.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Interrupts/SharedIRQHandler.cpp
|
|
|
|
Interrupts/UnhandledInterruptHandler.cpp
|
|
|
|
KSyms.cpp
|
2021-08-06 11:57:39 +00:00
|
|
|
Memory/AddressSpace.cpp
|
2021-08-06 08:45:34 +00: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 19:12:05 +00:00
|
|
|
Memory/RegionTree.cpp
|
2021-08-06 08:45:34 +00:00
|
|
|
Memory/RingBuffer.cpp
|
|
|
|
Memory/ScatterGatherList.cpp
|
2022-01-10 18:01:01 +00:00
|
|
|
Memory/ScopedAddressSpaceSwitcher.cpp
|
2022-05-13 00:22:23 +00:00
|
|
|
Memory/SharedFramebufferVMObject.cpp
|
2021-08-06 08:45:34 +00:00
|
|
|
Memory/SharedInodeVMObject.cpp
|
|
|
|
Memory/VMObject.cpp
|
2021-08-06 11:54:48 +00:00
|
|
|
Memory/VirtualRange.cpp
|
2021-09-07 09:40:31 +00:00
|
|
|
Locking/LockRank.cpp
|
2021-07-18 07:10:27 +00:00
|
|
|
Locking/Mutex.cpp
|
2023-02-24 18:10:59 +00: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 08:58:04 +00:00
|
|
|
Net/Intel/E1000ENetworkAdapter.cpp
|
|
|
|
Net/Intel/E1000NetworkAdapter.cpp
|
2021-12-25 09:09:34 +00:00
|
|
|
Net/Realtek/RTL8168NetworkAdapter.cpp
|
2023-07-02 15:39:47 +00:00
|
|
|
Net/VirtIO/VirtIONetworkAdapter.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Net/IPv4Socket.cpp
|
|
|
|
Net/LocalSocket.cpp
|
|
|
|
Net/LoopbackAdapter.cpp
|
|
|
|
Net/NetworkAdapter.cpp
|
|
|
|
Net/NetworkTask.cpp
|
2021-08-06 08:45:34 +00:00
|
|
|
Net/NetworkingManagement.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
|
2023-02-24 17:52:16 +00:00
|
|
|
Security/AddressSanitizer.cpp
|
2023-02-24 17:57:27 +00:00
|
|
|
Security/Credentials.cpp
|
2023-02-24 17:49:37 +00:00
|
|
|
Security/Random.cpp
|
2023-02-24 17:34:21 +00:00
|
|
|
Security/Jail.cpp
|
2023-02-24 17:52:16 +00:00
|
|
|
Security/UBSanitizer.cpp
|
2021-01-15 10:28:07 +00:00
|
|
|
Syscalls/anon_create.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/alarm.cpp
|
|
|
|
Syscalls/chdir.cpp
|
|
|
|
Syscalls/chmod.cpp
|
|
|
|
Syscalls/chown.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
|
2023-01-25 16:13:12 +00:00
|
|
|
Syscalls/execve.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/exit.cpp
|
2022-10-01 12:24:56 +00:00
|
|
|
Syscalls/faccessat.cpp
|
2022-06-18 16:37:54 +00:00
|
|
|
Syscalls/fallocate.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/fcntl.cpp
|
2023-01-25 15:19:30 +00:00
|
|
|
Syscalls/fork.cpp
|
2021-09-12 03:28:59 +00:00
|
|
|
Syscalls/fsync.cpp
|
2020-07-30 21:38:15 +00: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 20:26:02 +00:00
|
|
|
Syscalls/jail.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
|
2023-01-25 15:15:35 +00:00
|
|
|
Syscalls/mmap.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/mount.cpp
|
|
|
|
Syscalls/open.cpp
|
|
|
|
Syscalls/perf_event.cpp
|
|
|
|
Syscalls/pipe.cpp
|
|
|
|
Syscalls/pledge.cpp
|
2021-12-12 09:44:37 +00:00
|
|
|
Syscalls/poll.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
|
2023-08-25 21:47:42 +00:00
|
|
|
Syscalls/profiled_syscalls.cpp
|
2023-01-25 15:12:08 +00:00
|
|
|
Syscalls/ptrace.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/purge.cpp
|
|
|
|
Syscalls/read.cpp
|
|
|
|
Syscalls/readlink.cpp
|
|
|
|
Syscalls/realpath.cpp
|
|
|
|
Syscalls/rename.cpp
|
2022-01-31 21:09:30 +00:00
|
|
|
Syscalls/resource.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/rmdir.cpp
|
|
|
|
Syscalls/sched.cpp
|
|
|
|
Syscalls/sendfd.cpp
|
|
|
|
Syscalls/setpgid.cpp
|
|
|
|
Syscalls/setuid.cpp
|
2023-01-25 15:17:08 +00:00
|
|
|
Syscalls/sigaction.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
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
|
2023-02-24 20:18:34 +00:00
|
|
|
Syscalls/SyscallHandler.cpp
|
2020-07-30 21:38:15 +00: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 20:26:10 +00:00
|
|
|
Syscalls/utimensat.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
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
|
2023-07-08 11:18:32 +00:00
|
|
|
Devices/TTY/ConsoleManagement.cpp
|
|
|
|
Devices/TTY/MasterPTY.cpp
|
|
|
|
Devices/TTY/PTYMultiplexer.cpp
|
|
|
|
Devices/TTY/SlavePTY.cpp
|
|
|
|
Devices/TTY/TTY.cpp
|
|
|
|
Devices/TTY/VirtualConsole.cpp
|
2023-02-24 18:00:03 +00:00
|
|
|
Tasks/Coredump.cpp
|
|
|
|
Tasks/CrashHandler.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Tasks/FinalizerTask.cpp
|
2023-02-24 17:45:37 +00:00
|
|
|
Tasks/FutexQueue.cpp
|
2023-02-24 18:25:52 +00:00
|
|
|
Tasks/PerformanceEventBuffer.cpp
|
2023-07-09 22:20:48 +00:00
|
|
|
Tasks/PowerStateSwitchTask.cpp
|
2023-02-24 17:45:37 +00:00
|
|
|
Tasks/Process.cpp
|
|
|
|
Tasks/ProcessGroup.cpp
|
|
|
|
Tasks/ProcessList.cpp
|
|
|
|
Tasks/Scheduler.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Tasks/SyncTask.cpp
|
2023-02-24 17:45:37 +00:00
|
|
|
Tasks/Thread.cpp
|
|
|
|
Tasks/ThreadBlockers.cpp
|
|
|
|
Tasks/ThreadTracer.cpp
|
|
|
|
Tasks/WaitQueue.cpp
|
|
|
|
Tasks/WorkQueue.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Time/TimeManagement.cpp
|
2023-02-24 18:23:38 +00:00
|
|
|
Time/TimerQueue.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
)
|
|
|
|
|
2022-10-04 00:05:54 +00:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
2021-10-15 19:55:22 +00:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
2022-08-23 19:25:36 +00:00
|
|
|
|
2022-10-04 10:46:11 +00:00
|
|
|
Arch/x86_64/CMOS.cpp
|
|
|
|
Arch/x86_64/DebugOutput.cpp
|
|
|
|
Arch/x86_64/Delay.cpp
|
|
|
|
|
2023-06-09 19:50:11 +00:00
|
|
|
Arch/x86_64/Firmware/ACPI/StaticParsing.cpp
|
2023-06-09 18:24:25 +00:00
|
|
|
Arch/x86_64/Firmware/MultiProcessor/Parser.cpp
|
2023-06-09 18:22:30 +00: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 19:50:11 +00:00
|
|
|
|
2022-10-04 10:46:11 +00:00
|
|
|
Arch/x86_64/Hypervisor/BochsDisplayConnector.cpp
|
|
|
|
Arch/x86_64/Hypervisor/VMWareBackdoor.cpp
|
|
|
|
|
|
|
|
Arch/x86_64/CurrentTime.cpp
|
|
|
|
|
2022-12-25 18:01:14 +00:00
|
|
|
Arch/x86_64/I8042Reboot.cpp
|
2022-10-04 10:46:11 +00:00
|
|
|
Arch/x86_64/Interrupts/APIC.cpp
|
|
|
|
Arch/x86_64/Interrupts/IOAPIC.cpp
|
|
|
|
Arch/x86_64/Interrupts/PIC.cpp
|
2022-12-25 18:01:14 +00: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 10:46:11 +00: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 12:37:26 +00:00
|
|
|
Arch/x86_64/PCI/MSI.cpp
|
2022-10-04 10:46:11 +00:00
|
|
|
|
|
|
|
Arch/x86_64/VGA/IOArbiter.cpp
|
2022-10-25 16:55:42 +00:00
|
|
|
|
2023-06-09 19:13:04 +00:00
|
|
|
Arch/x86_64/PowerState.cpp
|
2022-12-25 18:01:14 +00:00
|
|
|
Arch/x86_64/RTC.cpp
|
|
|
|
Arch/x86_64/Shutdown.cpp
|
|
|
|
Arch/x86_64/SmapDisabler.cpp
|
|
|
|
|
2022-10-25 16:55:42 +00:00
|
|
|
# TODO: Share these with the aarch64 build
|
|
|
|
Interrupts/SpuriousInterruptHandler.cpp
|
2023-02-24 18:10:59 +00:00
|
|
|
kprintf.cpp
|
2021-10-15 19:55:22 +00:00
|
|
|
)
|
|
|
|
|
2021-08-27 19:23:43 +00:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
2022-10-04 10:46:11 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/Boot/ap_setup.S
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/InterruptEntry.cpp
|
2021-08-27 19:23:43 +00:00
|
|
|
)
|
2021-06-21 15:34:09 +00:00
|
|
|
|
2021-08-27 19:23:43 +00:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
2022-04-02 22:55:20 +00:00
|
|
|
|
2022-10-04 10:46:11 +00: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
|
2021-08-27 19:23:43 +00:00
|
|
|
)
|
2021-07-23 20:52:25 +00:00
|
|
|
|
|
|
|
if("${SERENITY_ARCH}" STREQUAL "x86_64")
|
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
2022-10-04 10:46:11 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86_64/SyscallEntry.cpp
|
2021-07-23 20:52:25 +00:00
|
|
|
)
|
|
|
|
endif()
|
2022-10-25 16:55:42 +00: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 05:51:46 +00:00
|
|
|
Arch/aarch64/RPi/MiniUART.cpp
|
2023-03-16 09:54:29 +00:00
|
|
|
Arch/aarch64/RPi/SDHostController.cpp
|
2022-10-25 16:55:42 +00:00
|
|
|
Arch/aarch64/RPi/Timer.cpp
|
|
|
|
Arch/aarch64/RPi/UART.cpp
|
2023-05-15 05:34:19 +00:00
|
|
|
Arch/aarch64/RPi/Watchdog.cpp
|
2022-10-25 16:55:42 +00:00
|
|
|
)
|
2023-01-06 15:15:32 +00:00
|
|
|
set(SOURCES_RUNNING_WITHOUT_MMU
|
|
|
|
Arch/aarch64/Exceptions.cpp
|
|
|
|
Arch/aarch64/MMU.cpp
|
|
|
|
Arch/aarch64/pre_init.cpp
|
2023-05-27 07:42:19 +00:00
|
|
|
Arch/aarch64/RPi/MMIO.cpp
|
2023-01-06 15:15:32 +00:00
|
|
|
)
|
2022-10-25 16:55:42 +00:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
|
|
|
${RPI_SOURCES}
|
2023-01-06 15:15:32 +00:00
|
|
|
${SOURCES_RUNNING_WITHOUT_MMU}
|
2022-10-25 16:55:42 +00:00
|
|
|
|
2023-06-09 19:50:11 +00:00
|
|
|
Arch/aarch64/Firmware/ACPI/StaticParsing.cpp
|
|
|
|
|
2022-10-25 16:55:42 +00:00
|
|
|
Arch/aarch64/boot.S
|
|
|
|
Arch/aarch64/BootPPMParser.cpp
|
2023-01-01 23:25:19 +00:00
|
|
|
Arch/aarch64/CPUID.cpp
|
2022-10-25 16:55:42 +00:00
|
|
|
Arch/aarch64/CurrentTime.cpp
|
|
|
|
Arch/aarch64/Dummy.cpp
|
|
|
|
Arch/aarch64/InterruptManagement.cpp
|
|
|
|
Arch/aarch64/Interrupts.cpp
|
|
|
|
Arch/aarch64/kprintf.cpp
|
2023-02-17 17:35:32 +00:00
|
|
|
Arch/aarch64/MainIdRegister.cpp
|
2022-10-25 16:55:42 +00:00
|
|
|
Arch/aarch64/PageDirectory.cpp
|
|
|
|
Arch/aarch64/Panic.cpp
|
|
|
|
Arch/aarch64/Processor.cpp
|
2023-06-09 19:13:04 +00:00
|
|
|
Arch/aarch64/PowerState.cpp
|
2022-10-25 16:55:42 +00:00
|
|
|
Arch/aarch64/SafeMem.cpp
|
|
|
|
Arch/aarch64/SmapDisabler.cpp
|
|
|
|
Arch/aarch64/vector_table.S
|
|
|
|
)
|
|
|
|
|
|
|
|
# Otherwise linker errors e.g undefined reference to `__aarch64_cas8_acq_rel'
|
2023-08-11 10:31:20 +00:00
|
|
|
add_compile_options(-mno-outline-atomics)
|
2023-01-06 15:15:32 +00: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 09:32:32 +00:00
|
|
|
elseif("${SERENITY_ARCH}" STREQUAL "riscv64")
|
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
|
|
|
Arch/Processor.cpp
|
|
|
|
kprintf.cpp
|
2023-09-02 20:52:30 +00:00
|
|
|
|
|
|
|
Arch/riscv64/boot.S
|
2023-10-21 14:23:58 +00:00
|
|
|
Arch/riscv64/Processor.cpp
|
2023-09-02 20:52:30 +00:00
|
|
|
Arch/riscv64/SBI.cpp
|
2023-08-17 09:32:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
add_compile_options(-fno-stack-protector -fno-sanitize=all)
|
2021-08-27 19:23:43 +00:00
|
|
|
endif()
|
2021-03-07 20:28:28 +00:00
|
|
|
|
2020-05-06 15:40:06 +00:00
|
|
|
set(AK_SOURCES
|
2023-02-06 19:15:30 +00:00
|
|
|
../AK/DOSPackedTime.cpp
|
2020-08-09 09:34:26 +00:00
|
|
|
../AK/GenericLexer.cpp
|
2020-12-31 11:17:03 +00:00
|
|
|
../AK/Hex.cpp
|
2023-02-07 11:43:54 +00:00
|
|
|
../AK/MemoryStream.cpp
|
2023-09-20 22:14:35 +00:00
|
|
|
../AK/SipHash.cpp
|
2023-02-07 11:43:54 +00:00
|
|
|
../AK/Stream.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
../AK/StringBuilder.cpp
|
|
|
|
../AK/StringUtils.cpp
|
|
|
|
../AK/StringView.cpp
|
2020-08-25 23:19:16 +00:00
|
|
|
../AK/Time.cpp
|
2023-02-05 10:27:38 +00:00
|
|
|
../AK/Error.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
|
|
|
)
|
|
|
|
|
2022-01-01 05:02:55 +00:00
|
|
|
set(EDID_SOURCES
|
|
|
|
../Userland/Libraries/LibEDID/DMT.cpp
|
|
|
|
../Userland/Libraries/LibEDID/EDID.cpp
|
|
|
|
../Userland/Libraries/LibEDID/VIC.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
|
|
|
)
|
|
|
|
|
2022-08-30 10:44:33 +00: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 05:42:18 +00:00
|
|
|
add_custom_target(generate_version_header DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/Version.h")
|
2022-08-30 10:44:33 +00:00
|
|
|
set(GENERATED_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/Version.h")
|
|
|
|
|
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-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
|
|
|
)
|
|
|
|
|
2022-02-12 19:21:28 +00:00
|
|
|
set(PARTITION_SOURCES
|
|
|
|
../Userland/Libraries/LibPartition/DiskPartitionMetadata.cpp
|
2022-03-02 01:01:52 +00:00
|
|
|
../Userland/Libraries/LibPartition/EBRPartitionTable.cpp
|
2022-03-02 01:21:35 +00:00
|
|
|
../Userland/Libraries/LibPartition/GUIDPartitionTable.cpp
|
2022-03-02 00:42:06 +00:00
|
|
|
../Userland/Libraries/LibPartition/MBRPartitionTable.cpp
|
2023-05-21 18:33:09 +00:00
|
|
|
../Userland/Libraries/LibPartition/PartitionableDevice.cpp
|
2022-03-01 23:09:46 +00:00
|
|
|
../Userland/Libraries/LibPartition/PartitionTable.cpp
|
2022-02-12 19:21:28 +00:00
|
|
|
)
|
|
|
|
|
2021-10-15 13:57:42 +00:00
|
|
|
set(SOURCES
|
2022-10-25 16:55:42 +00:00
|
|
|
${KERNEL_SOURCES}
|
|
|
|
${GENERATED_SOURCES}
|
2021-10-15 13:57:42 +00:00
|
|
|
${AK_SOURCES}
|
2022-10-25 16:55:42 +00:00
|
|
|
${EDID_SOURCES}
|
|
|
|
${ELF_SOURCES}
|
|
|
|
${VT_SOURCES}
|
|
|
|
${CRYPTO_SOURCES}
|
|
|
|
${PARTITION_SOURCES}
|
|
|
|
)
|
2020-05-06 15:40:06 +00:00
|
|
|
|
2021-10-13 23:04:04 +00:00
|
|
|
add_compile_options(-fsigned-char)
|
2021-09-07 08:21:36 +00:00
|
|
|
add_compile_options(-Wno-unknown-warning-option -Wvla -Wnull-dereference)
|
|
|
|
add_compile_options(-fno-rtti -ffreestanding -fbuiltin)
|
2022-05-14 11:50:07 +00:00
|
|
|
|
2023-09-18 19:45:14 +00:00
|
|
|
# We use __builtin_offsetof() on Processor, which inherits from ProcessorBase and is therefore a non-standard-layout type.
|
|
|
|
# This is an issue on non-Itanium ABIs (and in irrelevant edge cases), so we can safely ignore it.
|
|
|
|
add_compile_options(-Wno-invalid-offsetof)
|
|
|
|
|
2022-10-04 00:05:54 +00:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
2021-09-07 08:21:36 +00:00
|
|
|
add_compile_options(-mno-80387 -mno-mmx -mno-sse -mno-sse2)
|
2022-05-14 11:50:07 +00:00
|
|
|
elseif("${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
add_compile_options(-mgeneral-regs-only)
|
2021-08-27 19:23:43 +00:00
|
|
|
endif()
|
2022-05-14 11:50:07 +00:00
|
|
|
|
2021-09-07 08:21:36 +00:00
|
|
|
add_compile_options(-fno-asynchronous-unwind-tables)
|
|
|
|
add_compile_options(-fstack-protector-strong)
|
|
|
|
add_compile_options(-fno-exceptions)
|
2022-10-13 05:38:20 +00:00
|
|
|
add_compile_options(-nostdlib)
|
2020-05-06 15:40:06 +00:00
|
|
|
|
2022-06-24 07:34:38 +00: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 08:21:36 +00: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 10:11:12 +00:00
|
|
|
|
|
|
|
set(TARGET_STRING "")
|
2022-02-05 14:48:32 +00:00
|
|
|
|
2022-05-07 16:11:00 +00:00
|
|
|
|
|
|
|
# Prevent naively implemented string functions (like strlen) from being "optimized" into a call to themselves.
|
2023-02-24 18:10:59 +00:00
|
|
|
set_source_files_properties(Library/MiniStdLib.cpp
|
2022-05-07 16:11:00 +00:00
|
|
|
PROPERTIES COMPILE_FLAGS "-fno-tree-loop-distribution -fno-tree-loop-distribute-patterns")
|
|
|
|
|
2023-08-11 10:55:45 +00: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 08:21:36 +00: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 18:30:43 +00:00
|
|
|
add_compile_options(-Waddress-of-packed-member)
|
2021-09-07 08:21:36 +00: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 10:11:12 +00: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-01-31 21:09:30 +00:00
|
|
|
|
2022-02-05 14:48:32 +00:00
|
|
|
add_link_options(LINKER:--build-id=none LINKER:--pack-dyn-relocs=relr)
|
2021-07-13 14:43:45 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
macro (set_new_alignment alignment)
|
2021-09-07 08:21:36 +00:00
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
2021-07-13 14:43:45 +00:00
|
|
|
add_compile_options(-faligned-new=${alignment})
|
2021-09-07 08:21:36 +00:00
|
|
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
|
|
|
|
add_compile_options(-fnew-alignment=${alignment})
|
2021-07-13 14:43:45 +00:00
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2021-03-04 16:50:05 +00:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
2021-09-07 08:21:36 +00:00
|
|
|
add_compile_options(-mcmodel=large -mno-red-zone)
|
2021-07-13 14:43:45 +00:00
|
|
|
set_new_alignment(8)
|
2021-03-04 16:50:05 +00:00
|
|
|
endif()
|
|
|
|
|
2021-07-26 13:10:51 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-pie")
|
2021-07-23 10:56:35 +00:00
|
|
|
|
2021-06-06 23:15:07 +00: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 03:28:51 +00:00
|
|
|
add_compile_options(-fsanitize-coverage=trace-pc)
|
2021-06-06 23:15:07 +00: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 10:27:38 +00:00
|
|
|
../AK/Error.cpp
|
2021-06-06 23:15:07 +00:00
|
|
|
../AK/Format.cpp
|
|
|
|
../AK/StringBuilder.cpp
|
2022-10-04 10:46:11 +00:00
|
|
|
../Kernel/Arch/x86_64/Processor.cpp
|
2021-06-06 23:15:07 +00:00
|
|
|
../Kernel/Devices/KCOVDevice.cpp
|
|
|
|
../Kernel/Devices/KCOVInstance.cpp
|
|
|
|
../Kernel/FileSystem/File.cpp
|
2021-09-07 11:39:11 +00:00
|
|
|
../Kernel/FileSystem/OpenFileDescription.cpp
|
2021-06-06 23:15:07 +00: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 10:46:11 +00:00
|
|
|
../Kernel/Arch/x86_64/Interrupts.cpp
|
2023-02-24 20:18:34 +00:00
|
|
|
../Kernel/Syscall/SyscallHandler.cpp
|
2021-06-06 23:15:07 +00:00
|
|
|
)
|
|
|
|
set_source_files_properties(${KCOV_EXCLUDED_SOURCES} PROPERTIES COMPILE_FLAGS "-fno-sanitize-coverage=trace-pc")
|
2022-03-05 01:05:24 +00: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-06 23:15:07 +00:00
|
|
|
endif()
|
|
|
|
|
2022-05-11 08:31:16 +00:00
|
|
|
if (ENABLE_KERNEL_UNDEFINED_SANITIZER)
|
|
|
|
# Kernel Undefined Behavior Sanitizer (KUBSAN)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
|
|
|
|
endif()
|
2021-02-24 19:47:56 +00:00
|
|
|
|
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)
|
2021-08-25 03:28:51 +00:00
|
|
|
add_compile_options(-fsanitize=kernel-address)
|
2021-09-07 08:21:36 +00:00
|
|
|
add_link_options(-fsanitize=kernel-address)
|
2021-02-14 20:47:10 +00:00
|
|
|
endif()
|
|
|
|
|
2022-03-08 17:21:40 +00:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
add_compile_options(-fno-threadsafe-statics)
|
2022-12-20 18:49:35 +00: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 17:21:40 +00:00
|
|
|
endif()
|
|
|
|
|
2021-02-11 20:20:10 +00:00
|
|
|
add_compile_definitions(KERNEL)
|
2021-08-18 15:39:04 +00:00
|
|
|
add_link_options(LINKER:-z,notext)
|
|
|
|
|
2022-05-09 09:24:03 +00:00
|
|
|
add_library(kernel_heap STATIC ${KERNEL_HEAP_SOURCES})
|
2023-04-28 18:55:59 +00:00
|
|
|
add_dependencies(kernel_heap install_libc_headers)
|
2022-05-09 09:24:03 +00:00
|
|
|
|
2021-07-18 12:47:32 +00:00
|
|
|
add_executable(Kernel ${SOURCES})
|
2023-04-28 18:55:59 +00:00
|
|
|
add_dependencies(Kernel generate_EscapeSequenceStateMachine.h generate_version_header install_libc_headers)
|
2021-05-20 09:44:23 +00:00
|
|
|
|
2023-08-18 16:39:53 +00:00
|
|
|
if("${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
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)
|
|
|
|
elseif("${SERENITY_ARCH}" STREQUAL "riscv64")
|
|
|
|
target_link_options(Kernel PRIVATE LINKER:-T ${CMAKE_CURRENT_SOURCE_DIR}/Arch/riscv64/linker.ld -nostdlib LINKER:--no-pie)
|
|
|
|
set_target_properties(Kernel PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Arch/riscv64/linker.ld)
|
|
|
|
elseif ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
2022-03-08 17:21:40 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/linker.ld
|
2022-10-04 10:46:11 +00: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 17:21:40 +00: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-15 22:05:09 +00: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 17:21:40 +00:00
|
|
|
endif()
|
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-10-09 17:05:19 +00:00
|
|
|
add_definitions(-DENABLE_KERNEL_LTO)
|
2021-07-18 12:47:32 +00:00
|
|
|
set_property(TARGET Kernel PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
2021-09-21 20:59:03 +00:00
|
|
|
if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
set_property(TARGET kernel_heap PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
|
|
|
endif()
|
2021-04-29 13:25:31 +00:00
|
|
|
endif()
|
2021-07-13 14:43:45 +00:00
|
|
|
|
2022-05-09 09:24:03 +00: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 14:43:45 +00:00
|
|
|
endif()
|
|
|
|
|
2023-04-28 15:27:24 +00:00
|
|
|
add_custom_command(
|
2022-03-08 17:21:40 +00:00
|
|
|
TARGET Kernel POST_BUILD
|
2022-09-02 18:59:45 +00: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 17:21:40 +00: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 15:27:24 +00:00
|
|
|
)
|
2021-06-24 11:08:19 +00:00
|
|
|
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Kernel" DESTINATION boot)
|
2021-07-17 07:43:15 +00:00
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Kernel.debug" DESTINATION boot)
|
2021-07-14 19:04:18 +00:00
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kernel.map" DESTINATION res)
|
2020-05-06 15:40:06 +00:00
|
|
|
|
2023-05-16 06:58:34 +00: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 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
|
|
|
|
2023-08-17 09:32:32 +00:00
|
|
|
# Only x86 needs a Prekernel
|
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
2022-03-08 17:21:40 +00:00
|
|
|
add_subdirectory(Prekernel)
|
|
|
|
endif()
|