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)
|
|
|
|
elseif ("${SERENITY_ARCH}" STREQUAL "i686")
|
2021-03-04 16:50:05 +00:00
|
|
|
set(KERNEL_ARCH i386)
|
|
|
|
elseif("${SERENITY_ARCH}" STREQUAL "x86_64")
|
|
|
|
set(KERNEL_ARCH x86_64)
|
|
|
|
endif()
|
|
|
|
|
2020-08-10 15:44:35 +00:00
|
|
|
set(KERNEL_HEAP_SOURCES
|
|
|
|
Heap/kmalloc.cpp
|
|
|
|
)
|
|
|
|
|
2020-05-06 15:40:06 +00:00
|
|
|
set(KERNEL_SOURCES
|
2021-02-14 20:47:10 +00:00
|
|
|
AddressSanitizer.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
|
2021-08-13 06:10:43 +00:00
|
|
|
Bus/USB/UHCI/UHCIController.cpp
|
|
|
|
Bus/USB/UHCI/UHCIRootHub.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
|
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-05-06 15:40:06 +00:00
|
|
|
CommandLine.cpp
|
2021-08-22 12:51:04 +00:00
|
|
|
Coredump.cpp
|
2022-08-20 16:25:54 +00:00
|
|
|
Credentials.cpp
|
2020-11-02 18:16:01 +00:00
|
|
|
Devices/AsyncDeviceRequest.cpp
|
2021-11-23 00:13:02 +00:00
|
|
|
Devices/Audio/AC97.cpp
|
2022-02-11 19:47:45 +00:00
|
|
|
Devices/Audio/Channel.cpp
|
|
|
|
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-09-12 18:37:31 +00:00
|
|
|
Devices/ConsoleDevice.cpp
|
2021-01-01 10:20:55 +00:00
|
|
|
Devices/Device.cpp
|
2021-12-20 09:10:35 +00:00
|
|
|
Devices/DeviceControlDevice.cpp
|
2021-09-11 06:19:20 +00:00
|
|
|
Devices/DeviceManagement.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Devices/FullDevice.cpp
|
2021-06-06 23:15:07 +00:00
|
|
|
Devices/KCOVDevice.cpp
|
|
|
|
Devices/KCOVInstance.cpp
|
2021-01-29 12:03:25 +00:00
|
|
|
Devices/MemoryDevice.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Devices/NullDevice.cpp
|
2021-04-23 14:26:52 +00:00
|
|
|
Devices/PCISerialDevice.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Devices/RandomDevice.cpp
|
2022-02-15 19:24:31 +00:00
|
|
|
Devices/SelfTTYDevice.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Devices/SerialDevice.cpp
|
|
|
|
Devices/ZeroDevice.cpp
|
2021-04-02 20:21:35 +00:00
|
|
|
Devices/HID/HIDManagement.cpp
|
|
|
|
Devices/HID/KeyboardDevice.cpp
|
|
|
|
Devices/HID/MouseDevice.cpp
|
2021-06-22 21:24:25 +00:00
|
|
|
GlobalProcessExposed.cpp
|
2021-07-09 07:27:19 +00:00
|
|
|
Graphics/Bochs/GraphicsAdapter.cpp
|
2022-04-29 14:57:37 +00:00
|
|
|
Graphics/Bochs/QEMUDisplayConnector.cpp
|
2022-01-29 03:42:23 +00:00
|
|
|
Graphics/Console/BootFramebufferConsole.cpp
|
2021-06-12 12:30:05 +00:00
|
|
|
Graphics/Console/GenericFramebufferConsole.cpp
|
|
|
|
Graphics/Console/ContiguousFramebufferConsole.cpp
|
2022-07-13 17:11:28 +00:00
|
|
|
Graphics/Console/VGATextModeConsole.cpp
|
Kernel/Graphics: Introduce the DisplayConnector class
The DisplayConnector class is meant to replace the FramebufferDevice
class. The advantage of this class over the FramebufferDevice class is:
1. It removes the mmap interface entirely. This interface is unsafe, as
multiple processes could try to use it, and when switching to and from
text console mode, there's no "good" way to revoke a memory mapping from
this interface, let alone when there are multiple processes that call
this interface. Therefore, in the DisplayConnector class there's no
implementation for this method at all.
2. The class uses a new real-world structure called ModeSetting, which
takes into account the fact that real hardware requires more than width,
height and pitch settings to mode-set the display resolution.
3. The class assumes all instances should supply some sort of EDID,
so it facilitates such mechanism to do so. Even if a given driver does
not know what is the actual EDID, it will ask to create default-generic
EDID blob.
3. This class shifts the responsibilies of switching between console
mode and graphical mode from a GraphicsAdapter to the DisplayConnector
class, so when doing the switch, the GraphicsManagement code actually
asks each DisplayConnector object to do the switch and doesn't rely on
the GraphicsAdapter objects at all.
2022-04-29 09:44:46 +00:00
|
|
|
Graphics/DisplayConnector.cpp
|
2022-06-24 10:17:20 +00:00
|
|
|
Graphics/Generic/DisplayConnector.cpp
|
2021-03-05 12:23:08 +00:00
|
|
|
Graphics/GraphicsManagement.cpp
|
2022-04-30 05:28:38 +00:00
|
|
|
Graphics/Intel/NativeDisplayConnector.cpp
|
2021-07-08 17:30:13 +00:00
|
|
|
Graphics/Intel/NativeGraphicsAdapter.cpp
|
2022-03-18 14:46:55 +00:00
|
|
|
Graphics/VMWare/Console.cpp
|
|
|
|
Graphics/VMWare/GraphicsAdapter.cpp
|
|
|
|
Graphics/VMWare/DisplayConnector.cpp
|
2022-04-30 10:56:29 +00:00
|
|
|
Graphics/VirtIOGPU/DisplayConnector.cpp
|
2021-07-07 13:51:33 +00:00
|
|
|
Graphics/VirtIOGPU/Console.cpp
|
2022-02-13 05:45:30 +00:00
|
|
|
Graphics/VirtIOGPU/GPU3DDevice.cpp
|
2021-07-07 13:51:33 +00:00
|
|
|
Graphics/VirtIOGPU/GraphicsAdapter.cpp
|
Kernel: Introduce the IOWindow class
This class is intended to replace all IOAddress usages in the Kernel
codebase altogether. The idea is to ensure IO can be done in
arch-specific manner that is determined mostly in compile-time, but to
still be able to use most of the Kernel code in non-x86 builds. Specific
devices that rely on x86-specific IO instructions are already placed in
the Arch/x86 directory and are omitted for non-x86 builds.
The reason this works so well is the fact that x86 IO space acts in a
similar fashion to the traditional memory space being available in most
CPU architectures - the x86 IO space is essentially just an array of
bytes like the physical memory address space, but requires x86 IO
instructions to load and store data. Therefore, many devices allow host
software to interact with the hardware registers in both ways, with a
noticeable trend even in the modern x86 hardware to move away from the
old x86 IO space to exclusively using memory-mapped IO.
Therefore, the IOWindow class encapsulates both methods for x86 builds.
The idea is to allow PCI devices to be used in either way in x86 builds,
so when trying to map an IOWindow on a PCI BAR, the Kernel will try to
find the proper method being declared with the PCI BAR flags.
For old PCI hardware on non-x86 builds this might turn into a problem as
we can't use port mapped IO, so the Kernel will gracefully fail with
ENOTSUP error code if that's the case, as there's really nothing we can
do within such case.
For general IO, the read{8,16,32} and write{8,16,32} methods are
available as a convenient API for other places in the Kernel. There are
simply no direct 64-bit IO API methods yet, as it's not needed right now
and is not considered to be Arch-agnostic too - the x86 IO space doesn't
support generating 64 bit cycle on IO bus and instead requires two 2
32-bit accesses. If for whatever reason it appears to be necessary to do
IO in such manner, it could probably be added with some neat tricks to
do so. It is recommended to use Memory::TypedMapping struct if direct 64
bit IO is actually needed.
2022-09-23 08:50:04 +00:00
|
|
|
IOWindow.cpp
|
2021-06-06 23:15:07 +00:00
|
|
|
SanCov.cpp
|
2021-11-19 09:52:07 +00:00
|
|
|
Storage/ATA/AHCI/Controller.cpp
|
|
|
|
Storage/ATA/AHCI/Port.cpp
|
|
|
|
Storage/ATA/AHCI/InterruptHandler.cpp
|
|
|
|
Storage/ATA/GenericIDE/Controller.cpp
|
|
|
|
Storage/ATA/GenericIDE/Channel.cpp
|
Kernel/Storage: Introduce new boot device addressing modes
Before of this patch, we supported two methods to address a boot device:
1. Specifying root=/dev/hdXY, where X is a-z letter which corresponds to
a boot device, and Y as number from 1 to 16, to indicate the partition
number, which can be omitted to instruct the kernel to use a raw device
rather than a partition on a raw device.
2. Specifying root=PARTUUID: with a GUID string of a GUID partition. In
case of existing storage device with GPT partitions, this is most likely
the safest option to ensure booting from persistent storage.
While option 2 is more advanced and reliable, the first option has 2
caveats:
1. The string prefix "/dev/hd" doesn't mean anything beside a convention
on Linux installations, that was taken into use in Serenity. In Serenity
we don't mount DevTmpFS before we mount the boot device on /, so the
kernel doesn't really access /dev anyway, so this convention is only a
big misleading relic that can easily make the user to assume we access
/dev early on boot.
2. This convention although resemble the simple linux convention, is
quite limited in specifying a correct boot device across hardware setup
changes, so option 2 was recommended to ensure the system is always
bootable.
With these caveats in mind, this commit tries to fix the problem with
adding more addressing options as well as to remove the first option
being mentioned above of addressing.
To sum it up, there are 4 addressing options:
1. Hardware relative address - Each instance of StorageController is
assigned with a index number relative to the type of hardware it handles
which makes it possible to address storage devices with a prefix of the
commandset ("ata" for ATA, "nvme" for NVMe, "ramdisk" for Plain memory),
and then the number for the parent controller relative hardware index,
another number LUN target_id, and a third number for LUN disk_id.
2. LUN address - Similar to the previous option, but instead we rely on
the parent controller absolute index for the first number.
3. Block device major and minor numbers - by specifying the major and
minor numbers, the kernel can simply try to get the corresponding block
device and use it as the boot device.
4. GUID string, in the same fashion like before, so the user use the
"PARTUUID:" string prefix and add the GUID of the GPT partition.
For the new address modes 1 and 2, the user can choose to also specify a
partition out of the selected boot device. To do that, the user needs to
append the semicolon character and then add the string "partX" where X
is to be changed for the partition number. We start counting from 0, and
therefore the first partition number is 0 and not 1 in the kernel boot
argument.
2022-08-05 17:32:26 +00:00
|
|
|
Storage/ATA/ATAController.cpp
|
2021-11-13 08:19:31 +00:00
|
|
|
Storage/ATA/ATADevice.cpp
|
|
|
|
Storage/ATA/ATADiskDevice.cpp
|
2021-11-26 17:39:26 +00:00
|
|
|
Storage/ATA/ATAPort.cpp
|
2021-12-16 15:07:54 +00:00
|
|
|
Storage/NVMe/NVMeController.cpp
|
|
|
|
Storage/NVMe/NVMeNameSpace.cpp
|
2022-01-27 11:14:58 +00:00
|
|
|
Storage/NVMe/NVMeInterruptQueue.cpp
|
|
|
|
Storage/NVMe/NVMePollQueue.cpp
|
2021-12-16 15:07:54 +00:00
|
|
|
Storage/NVMe/NVMeQueue.cpp
|
2022-03-19 09:55:55 +00:00
|
|
|
Storage/Ramdisk/Controller.cpp
|
|
|
|
Storage/Ramdisk/Device.cpp
|
2022-03-02 01:24:01 +00:00
|
|
|
Storage/DiskPartition.cpp
|
Kernel/Storage: Add LUN address to each StorageDevice
LUN address is essentially how people used to address SCSI devices back
in the day we had these devices more in use. However, SCSI was taken as
an abstraction layer for many Unix and Unix-like systems, so it still
common to see LUN addresses in use. In Serenity, we don't really provide
such abstraction layer, and therefore until now, we didn't use LUNs too.
However (again), this changes, as we want to let users to address their
devices under SysFS easily. LUNs make sense in that regard, because they
can be easily adapted to different interfaces besides SCSI.
For example, for legacy ATA hard drive being connected to the first IDE
controller which was enumerated on the PCI bus, and then to the primary
channel as slave device, the LUN address would be 0:0:1.
To make this happen, we add unique ID number to each StorageController,
which increments by 1 for each new instance of StorageController. Then,
we adapt the ATA and NVMe devices to use these numbers and generate LUN
in the construction time.
2022-04-22 15:52:20 +00:00
|
|
|
Storage/StorageController.cpp
|
2020-12-19 10:50:57 +00:00
|
|
|
Storage/StorageDevice.cpp
|
2020-12-19 13:25:06 +00:00
|
|
|
Storage/StorageManagement.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
DoubleBuffer.cpp
|
2021-01-15 10:28:07 +00:00
|
|
|
FileSystem/AnonymousFile.cpp
|
2020-07-02 09:48:08 +00:00
|
|
|
FileSystem/BlockBasedFileSystem.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
FileSystem/Custody.cpp
|
|
|
|
FileSystem/DevPtsFS.cpp
|
2021-08-14 13:28:09 +00:00
|
|
|
FileSystem/DevTmpFS.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
FileSystem/Ext2FileSystem.cpp
|
|
|
|
FileSystem/FIFO.cpp
|
|
|
|
FileSystem/File.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
FileSystem/FileBackedFileSystem.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
FileSystem/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
|
2021-07-29 20:19:12 +00:00
|
|
|
FileSystem/ISO9660FileSystem.cpp
|
2021-07-10 22:46:06 +00:00
|
|
|
FileSystem/Mount.cpp
|
2021-09-07 11:39:11 +00:00
|
|
|
FileSystem/OpenFileDescription.cpp
|
2020-07-02 10:05:56 +00:00
|
|
|
FileSystem/Plan9FileSystem.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
FileSystem/ProcFS.cpp
|
2021-03-13 10:01:44 +00:00
|
|
|
FileSystem/SysFS.cpp
|
2022-04-22 06:44:31 +00:00
|
|
|
FileSystem/SysFS/Component.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-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 07:59:32 +00:00
|
|
|
FileSystem/SysFS/Subsystems/Firmware/BIOS/Component.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Firmware/BIOS/Directory.cpp
|
2022-04-22 06:44:31 +00:00
|
|
|
FileSystem/SysFS/Subsystems/Firmware/Directory.cpp
|
|
|
|
FileSystem/SysFS/Subsystems/Firmware/PowerStateSwitch.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
FileSystem/TmpFS.cpp
|
|
|
|
FileSystem/VirtualFileSystem.cpp
|
2022-04-22 07:34:15 +00:00
|
|
|
Firmware/BIOS.cpp
|
2021-09-11 07:39:47 +00:00
|
|
|
Firmware/ACPI/Initialize.cpp
|
|
|
|
Firmware/ACPI/Parser.cpp
|
2021-12-23 15:51:11 +00:00
|
|
|
Firmware/MultiProcessor/Parser.cpp
|
2020-12-22 06:21:58 +00:00
|
|
|
FutexQueue.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Interrupts/GenericInterruptHandler.cpp
|
|
|
|
Interrupts/IRQHandler.cpp
|
|
|
|
Interrupts/SharedIRQHandler.cpp
|
|
|
|
Interrupts/SpuriousInterruptHandler.cpp
|
|
|
|
Interrupts/UnhandledInterruptHandler.cpp
|
|
|
|
KBufferBuilder.cpp
|
2021-07-06 09:16:17 +00:00
|
|
|
KLexicalPath.cpp
|
2021-05-28 07:25:02 +00:00
|
|
|
KString.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
KSyms.cpp
|
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/PageDirectory.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-07-18 12:47:32 +00:00
|
|
|
MiniStdLib.cpp
|
2021-09-07 09:40:31 +00:00
|
|
|
Locking/LockRank.cpp
|
2021-07-18 07:10:27 +00:00
|
|
|
Locking/Mutex.cpp
|
2022-08-23 20:14:07 +00:00
|
|
|
Locking/Spinlock.cpp
|
2021-12-25 08:58:04 +00:00
|
|
|
Net/Intel/E1000ENetworkAdapter.cpp
|
|
|
|
Net/Intel/E1000NetworkAdapter.cpp
|
2021-12-25 09:06:12 +00:00
|
|
|
Net/NE2000/NetworkAdapter.cpp
|
2021-12-25 09:09:34 +00:00
|
|
|
Net/Realtek/RTL8139NetworkAdapter.cpp
|
|
|
|
Net/Realtek/RTL8168NetworkAdapter.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
|
2021-02-14 08:01:52 +00:00
|
|
|
Panic.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
PerformanceEventBuffer.cpp
|
|
|
|
Process.cpp
|
Kernel: Introduce the new ProcFS design
The new ProcFS design consists of two main parts:
1. The representative ProcFS class, which is derived from the FS class.
The ProcFS and its inodes are much more lean - merely 3 classes to
represent the common type of inodes - regular files, symbolic links and
directories. They're backed by a ProcFSExposedComponent object, which
is responsible for the functional operation behind the scenes.
2. The backend of the ProcFS - the ProcFSComponentsRegistrar class
and all derived classes from the ProcFSExposedComponent class. These
together form the entire backend and handle all the functions you can
expect from the ProcFS.
The ProcFSExposedComponent derived classes split to 3 types in the
manner of lifetime in the kernel:
1. Persistent objects - this category includes all basic objects, like
the root folder, /proc/bus folder, main blob files in the root folders,
etc. These objects are persistent and cannot die ever.
2. Semi-persistent objects - this category includes all PID folders,
and subdirectories to the PID folders. It also includes exposed objects
like the unveil JSON'ed blob. These object are persistent as long as the
the responsible process they represent is still alive.
3. Dynamic objects - this category includes files in the subdirectories
of a PID folder, like /proc/PID/fd/* or /proc/PID/stacks/*. Essentially,
these objects are always created dynamically and when no longer in need
after being used, they're deallocated.
Nevertheless, the new allocated backend objects and inodes try to use
the same InodeIndex if possible - this might change only when a thread
dies and a new thread is born with a new thread stack, or when a file
descriptor is closed and a new one within the same file descriptor
number is opened. This is needed to actually be able to do something
useful with these objects.
The new design assures that many ProcFS instances can be used at once,
with one backend for usage for all instances.
2021-06-12 01:23:58 +00:00
|
|
|
ProcessExposed.cpp
|
2021-06-22 21:24:25 +00:00
|
|
|
ProcessSpecificExposed.cpp
|
2020-08-15 19:13:19 +00:00
|
|
|
ProcessGroup.cpp
|
2021-08-14 12:43:34 +00:00
|
|
|
ProcessProcFSTraits.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
Random.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Scheduler.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
StdLib.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Syscall.cpp
|
2021-01-15 10:28:07 +00:00
|
|
|
Syscalls/anon_create.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/access.cpp
|
|
|
|
Syscalls/alarm.cpp
|
|
|
|
Syscalls/beep.cpp
|
|
|
|
Syscalls/chdir.cpp
|
|
|
|
Syscalls/chmod.cpp
|
|
|
|
Syscalls/chown.cpp
|
|
|
|
Syscalls/clock.cpp
|
|
|
|
Syscalls/debug.cpp
|
2020-08-04 11:51:11 +00:00
|
|
|
Syscalls/disown.cpp
|
2020-08-15 08:54:00 +00:00
|
|
|
Syscalls/dup2.cpp
|
2021-03-09 07:16:00 +00:00
|
|
|
Syscalls/emuctl.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/execve.cpp
|
|
|
|
Syscalls/exit.cpp
|
2022-06-18 16:37:54 +00:00
|
|
|
Syscalls/fallocate.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/fcntl.cpp
|
|
|
|
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
|
2021-01-30 20:35:54 +00:00
|
|
|
Syscalls/keymap.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/kill.cpp
|
|
|
|
Syscalls/link.cpp
|
|
|
|
Syscalls/lseek.cpp
|
|
|
|
Syscalls/mkdir.cpp
|
|
|
|
Syscalls/mknod.cpp
|
|
|
|
Syscalls/mmap.cpp
|
|
|
|
Syscalls/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
|
|
|
|
Syscalls/ptrace.cpp
|
|
|
|
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
|
|
|
|
Syscalls/sigaction.cpp
|
|
|
|
Syscalls/socket.cpp
|
|
|
|
Syscalls/stat.cpp
|
2021-05-19 09:31:43 +00:00
|
|
|
Syscalls/statvfs.cpp
|
2020-07-30 21:38:15 +00:00
|
|
|
Syscalls/sync.cpp
|
|
|
|
Syscalls/sysconf.cpp
|
|
|
|
Syscalls/thread.cpp
|
|
|
|
Syscalls/times.cpp
|
|
|
|
Syscalls/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
|
2021-04-16 19:58:51 +00:00
|
|
|
TTY/ConsoleManagement.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
TTY/MasterPTY.cpp
|
|
|
|
TTY/PTYMultiplexer.cpp
|
|
|
|
TTY/SlavePTY.cpp
|
|
|
|
TTY/TTY.cpp
|
|
|
|
TTY/VirtualConsole.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
Tasks/FinalizerTask.cpp
|
|
|
|
Tasks/SyncTask.cpp
|
|
|
|
Thread.cpp
|
2020-11-29 23:05:27 +00:00
|
|
|
ThreadBlockers.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
ThreadTracer.cpp
|
|
|
|
Time/TimeManagement.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
TimerQueue.cpp
|
2021-02-05 18:44:26 +00:00
|
|
|
UBSanitizer.cpp
|
2020-09-12 03:11:07 +00:00
|
|
|
UserOrKernelBuffer.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
WaitQueue.cpp
|
2021-02-06 06:36:38 +00:00
|
|
|
WorkQueue.cpp
|
2020-05-16 10:00:04 +00:00
|
|
|
kprintf.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
)
|
|
|
|
|
2021-08-27 19:23:43 +00:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "i686" OR "${SERENITY_ARCH}" STREQUAL "x86_64")
|
2021-10-15 19:55:22 +00:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
2022-09-03 16:57:09 +00:00
|
|
|
Arch/x86/init.cpp
|
|
|
|
|
2022-08-23 19:25:36 +00:00
|
|
|
Arch/Processor.cpp
|
|
|
|
|
2022-09-03 16:52:14 +00:00
|
|
|
Arch/x86/common/Interrupts/APIC.cpp
|
|
|
|
Arch/x86/common/Interrupts/IOAPIC.cpp
|
|
|
|
Arch/x86/common/Interrupts/PIC.cpp
|
|
|
|
|
2022-09-02 08:35:12 +00:00
|
|
|
Arch/x86/common/CMOS.cpp
|
2022-09-02 10:15:27 +00:00
|
|
|
Arch/x86/common/DebugOutput.cpp
|
2022-09-02 08:23:32 +00:00
|
|
|
Arch/x86/common/Delay.cpp
|
2022-09-02 07:17:55 +00:00
|
|
|
Arch/x86/common/I8042Reboot.cpp
|
2022-09-02 12:50:56 +00:00
|
|
|
Arch/x86/common/PCSpeaker.cpp
|
2022-09-02 08:35:12 +00:00
|
|
|
Arch/x86/common/RTC.cpp
|
2021-10-16 21:41:09 +00:00
|
|
|
Arch/x86/common/ScopedCritical.cpp
|
|
|
|
Arch/x86/common/SmapDisabler.cpp
|
2022-09-02 07:17:55 +00:00
|
|
|
Arch/x86/common/Shutdown.cpp
|
2022-09-02 10:41:48 +00:00
|
|
|
|
2022-09-03 09:30:39 +00:00
|
|
|
Arch/x86/Hypervisor/BochsDisplayConnector.cpp
|
2022-09-02 14:26:54 +00:00
|
|
|
Arch/x86/Hypervisor/VMWareBackdoor.cpp
|
|
|
|
|
2022-09-03 07:25:33 +00:00
|
|
|
Arch/x86/ISABus/HID/PS2KeyboardDevice.cpp
|
|
|
|
Arch/x86/ISABus/HID/PS2MouseDevice.cpp
|
|
|
|
Arch/x86/ISABus/HID/VMWareMouseDevice.cpp
|
|
|
|
Arch/x86/ISABus/I8042Controller.cpp
|
2022-09-03 05:15:32 +00:00
|
|
|
Arch/x86/ISABus/IDEController.cpp
|
Kernel: Introduce the IOWindow class
This class is intended to replace all IOAddress usages in the Kernel
codebase altogether. The idea is to ensure IO can be done in
arch-specific manner that is determined mostly in compile-time, but to
still be able to use most of the Kernel code in non-x86 builds. Specific
devices that rely on x86-specific IO instructions are already placed in
the Arch/x86 directory and are omitted for non-x86 builds.
The reason this works so well is the fact that x86 IO space acts in a
similar fashion to the traditional memory space being available in most
CPU architectures - the x86 IO space is essentially just an array of
bytes like the physical memory address space, but requires x86 IO
instructions to load and store data. Therefore, many devices allow host
software to interact with the hardware registers in both ways, with a
noticeable trend even in the modern x86 hardware to move away from the
old x86 IO space to exclusively using memory-mapped IO.
Therefore, the IOWindow class encapsulates both methods for x86 builds.
The idea is to allow PCI devices to be used in either way in x86 builds,
so when trying to map an IOWindow on a PCI BAR, the Kernel will try to
find the proper method being declared with the PCI BAR flags.
For old PCI hardware on non-x86 builds this might turn into a problem as
we can't use port mapped IO, so the Kernel will gracefully fail with
ENOTSUP error code if that's the case, as there's really nothing we can
do within such case.
For general IO, the read{8,16,32} and write{8,16,32} methods are
available as a convenient API for other places in the Kernel. There are
simply no direct 64-bit IO API methods yet, as it's not needed right now
and is not considered to be Arch-agnostic too - the x86 IO space doesn't
support generating 64 bit cycle on IO bus and instead requires two 2
32-bit accesses. If for whatever reason it appears to be necessary to do
IO in such manner, it could probably be added with some neat tricks to
do so. It is recommended to use Memory::TypedMapping struct if direct 64
bit IO is actually needed.
2022-09-23 08:50:04 +00:00
|
|
|
Arch/x86/ISABus/SerialDevice.cpp
|
2022-09-02 10:41:48 +00:00
|
|
|
Arch/x86/PCI/Controller/HostBridge.cpp
|
2022-09-03 13:23:44 +00:00
|
|
|
Arch/x86/PCI/IDELegacyModeController.cpp
|
2022-09-02 13:06:38 +00:00
|
|
|
Arch/x86/PCI/Initializer.cpp
|
2022-09-23 08:06:14 +00:00
|
|
|
|
2022-09-23 08:41:59 +00:00
|
|
|
Arch/x86/Time/APICTimer.cpp
|
|
|
|
Arch/x86/Time/HPET.cpp
|
|
|
|
Arch/x86/Time/HPETComparator.cpp
|
|
|
|
Arch/x86/Time/PIT.cpp
|
|
|
|
Arch/x86/Time/RTC.cpp
|
|
|
|
|
2022-09-23 08:06:14 +00:00
|
|
|
Arch/x86/VGA/IOArbiter.cpp
|
2021-10-15 19:55:22 +00:00
|
|
|
)
|
|
|
|
|
2021-08-27 19:23:43 +00:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/${KERNEL_ARCH}/ASM_wrapper.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/${KERNEL_ARCH}/Boot/ap_setup.S
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/${KERNEL_ARCH}/InterruptEntry.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/${KERNEL_ARCH}/Processor.cpp
|
|
|
|
)
|
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
|
|
|
|
2021-08-27 19:23:43 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/ASM_wrapper.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/CPU.cpp
|
2022-03-27 11:49:38 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/CPUID.cpp
|
2022-05-30 07:04:37 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/CrashHandler.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/InterruptManagement.cpp
|
2021-08-27 19:23:43 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/Interrupts.cpp
|
2022-04-02 22:56:20 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/PageDirectory.cpp
|
2021-08-27 19:23:43 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/Processor.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/ProcessorInfo.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/SafeMem.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/TrapFrame.cpp
|
|
|
|
)
|
2021-07-23 20:52:25 +00:00
|
|
|
|
|
|
|
if("${SERENITY_ARCH}" STREQUAL "x86_64")
|
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/${KERNEL_ARCH}/SyscallEntry.cpp
|
|
|
|
)
|
|
|
|
endif()
|
2022-07-14 10:58:20 +00:00
|
|
|
|
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "i686")
|
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/${KERNEL_ARCH}/Atomics.cpp
|
|
|
|
)
|
|
|
|
endif()
|
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
|
2020-08-09 09:34:26 +00:00
|
|
|
../AK/GenericLexer.cpp
|
2020-12-31 11:17:03 +00:00
|
|
|
../AK/Hex.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
../AK/StringBuilder.cpp
|
|
|
|
../AK/StringUtils.cpp
|
|
|
|
../AK/StringView.cpp
|
2020-08-25 23:19:16 +00:00
|
|
|
../AK/Time.cpp
|
2020-09-22 11:05:40 +00:00
|
|
|
../AK/Format.cpp
|
2020-12-31 11:17:03 +00:00
|
|
|
../AK/UUID.cpp
|
2020-05-06 15:40:06 +00:00
|
|
|
)
|
|
|
|
|
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
|
|
|
)
|
|
|
|
|
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
|
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
|
|
|
|
${AK_SOURCES}
|
|
|
|
)
|
2021-08-28 17:43:55 +00:00
|
|
|
if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
set(SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
|
|
|
${SOURCES}
|
2022-01-01 05:02:55 +00:00
|
|
|
${EDID_SOURCES}
|
2021-08-28 17:43:55 +00:00
|
|
|
${ELF_SOURCES}
|
|
|
|
${VT_SOURCES}
|
|
|
|
${CRYPTO_SOURCES}
|
2022-02-12 19:21:28 +00:00
|
|
|
${PARTITION_SOURCES}
|
2021-08-28 17:43:55 +00:00
|
|
|
)
|
|
|
|
else()
|
2022-04-03 20:42:10 +00:00
|
|
|
set(RPI_SOURCES
|
2022-09-02 10:15:27 +00:00
|
|
|
Arch/aarch64/RPi/DebugOutput.cpp
|
2022-04-03 20:42:10 +00:00
|
|
|
Arch/aarch64/RPi/Framebuffer.cpp
|
2022-05-09 18:46:51 +00:00
|
|
|
Arch/aarch64/RPi/GPIO.cpp
|
2022-05-30 07:30:11 +00:00
|
|
|
Arch/aarch64/RPi/InterruptController.cpp
|
2022-04-03 20:42:10 +00:00
|
|
|
Arch/aarch64/RPi/Mailbox.cpp
|
2022-05-09 18:46:51 +00:00
|
|
|
Arch/aarch64/RPi/MMIO.cpp
|
2022-04-03 20:42:10 +00:00
|
|
|
Arch/aarch64/RPi/Timer.cpp
|
|
|
|
Arch/aarch64/RPi/UART.cpp
|
|
|
|
)
|
2021-08-28 17:43:55 +00:00
|
|
|
set(SOURCES
|
2022-04-02 22:49:07 +00:00
|
|
|
${AK_SOURCES}
|
2022-04-03 20:42:10 +00:00
|
|
|
${RPI_SOURCES}
|
2022-04-02 22:49:07 +00:00
|
|
|
|
2022-08-23 19:25:36 +00:00
|
|
|
Arch/Processor.cpp
|
|
|
|
|
2022-05-09 21:43:36 +00:00
|
|
|
Arch/aarch64/boot.S
|
2022-03-08 17:21:40 +00:00
|
|
|
Arch/aarch64/BootPPMParser.cpp
|
2022-04-08 01:51:08 +00:00
|
|
|
Arch/aarch64/CrashHandler.cpp
|
|
|
|
Arch/aarch64/Dummy.cpp
|
2022-05-09 21:20:57 +00:00
|
|
|
Arch/aarch64/Exceptions.cpp
|
2022-05-09 18:46:51 +00:00
|
|
|
Arch/aarch64/init.cpp
|
2022-05-30 07:43:51 +00:00
|
|
|
Arch/aarch64/InterruptManagement.cpp
|
2022-05-11 14:54:03 +00:00
|
|
|
Arch/aarch64/Interrupts.cpp
|
2022-05-02 16:39:31 +00:00
|
|
|
Arch/aarch64/kprintf.cpp
|
2022-04-08 01:51:08 +00:00
|
|
|
Arch/aarch64/MainIdRegister.cpp
|
2022-05-09 21:20:57 +00:00
|
|
|
Arch/aarch64/MMU.cpp
|
2022-04-02 22:56:20 +00:00
|
|
|
Arch/aarch64/PageDirectory.cpp
|
2022-05-02 23:39:47 +00:00
|
|
|
Arch/aarch64/Panic.cpp
|
2022-05-09 10:14:20 +00:00
|
|
|
Arch/aarch64/Processor.cpp
|
2022-05-02 21:01:03 +00:00
|
|
|
Arch/aarch64/SafeMem.cpp
|
2022-04-08 01:51:08 +00:00
|
|
|
Arch/aarch64/ScopedCritical.cpp
|
|
|
|
Arch/aarch64/SmapDisabler.cpp
|
2022-03-08 17:21:40 +00:00
|
|
|
Arch/aarch64/vector_table.S
|
2022-04-02 22:49:19 +00:00
|
|
|
|
2022-04-08 01:51:08 +00:00
|
|
|
# Files from base Kernel
|
2022-08-06 17:49:19 +00:00
|
|
|
CommandLine.cpp
|
|
|
|
KString.cpp
|
2022-05-02 20:34:58 +00:00
|
|
|
KSyms.cpp
|
2022-05-09 18:46:51 +00:00
|
|
|
MiniStdLib.cpp
|
2022-05-09 22:31:51 +00:00
|
|
|
UBSanitizer.cpp
|
2022-04-02 23:06:34 +00:00
|
|
|
|
2022-08-06 17:47:20 +00:00
|
|
|
Devices/DeviceManagement.cpp
|
|
|
|
|
2022-08-06 02:16:24 +00:00
|
|
|
Graphics/Console/BootFramebufferConsole.cpp
|
|
|
|
Graphics/Console/GenericFramebufferConsole.cpp
|
|
|
|
|
2022-08-23 20:14:07 +00:00
|
|
|
Locking/Spinlock.cpp
|
|
|
|
|
2022-04-02 22:49:19 +00:00
|
|
|
Memory/AddressSpace.cpp
|
|
|
|
Memory/AnonymousVMObject.cpp
|
|
|
|
Memory/InodeVMObject.cpp
|
2022-05-09 18:46:51 +00:00
|
|
|
Memory/MemoryManager.cpp
|
|
|
|
Memory/PageDirectory.cpp
|
2022-04-02 22:49:19 +00:00
|
|
|
Memory/PhysicalPage.cpp
|
2022-05-09 18:46:51 +00:00
|
|
|
Memory/PhysicalRegion.cpp
|
2022-04-02 22:49:19 +00:00
|
|
|
Memory/PhysicalZone.cpp
|
|
|
|
Memory/PrivateInodeVMObject.cpp
|
|
|
|
Memory/Region.cpp
|
2022-04-03 22:13:04 +00:00
|
|
|
Memory/RegionTree.cpp
|
2022-04-02 22:49:19 +00:00
|
|
|
Memory/RingBuffer.cpp
|
|
|
|
Memory/ScatterGatherList.cpp
|
2022-05-09 18:46:51 +00:00
|
|
|
Memory/SharedInodeVMObject.cpp
|
2022-04-02 22:49:19 +00:00
|
|
|
Memory/VirtualRange.cpp
|
|
|
|
Memory/VMObject.cpp
|
2022-05-11 14:54:03 +00:00
|
|
|
|
|
|
|
Interrupts/GenericInterruptHandler.cpp
|
2022-05-16 13:19:49 +00:00
|
|
|
Interrupts/IRQHandler.cpp
|
2022-05-16 13:54:26 +00:00
|
|
|
Interrupts/SharedIRQHandler.cpp
|
|
|
|
Interrupts/UnhandledInterruptHandler.cpp
|
2021-08-28 17:43:55 +00:00
|
|
|
)
|
2021-10-13 18:21:24 +00:00
|
|
|
|
|
|
|
# Otherwise linker errors e.g undefined reference to `__aarch64_cas8_acq_rel'
|
2021-10-14 19:22:45 +00:00
|
|
|
add_compile_options(-mno-outline-atomics -latomic)
|
2022-05-02 15:40:10 +00:00
|
|
|
|
|
|
|
# FIXME: Remove this once compiling MemoryManager.cpp doesn't give the nonnull error anymore.
|
|
|
|
add_compile_options(-Wno-nonnull)
|
2021-08-28 17:43:55 +00:00
|
|
|
endif()
|
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
|
|
|
|
2021-08-27 19:23:43 +00:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "i686" OR "${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)
|
2021-08-08 02:13:26 +00:00
|
|
|
# FIXME: remove -nodefaultlibs after the next toolchain update
|
2021-09-07 08:21:36 +00:00
|
|
|
add_compile_options(-nodefaultlibs -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.
|
2022-05-14 11:53:53 +00:00
|
|
|
set_source_files_properties(MiniStdLib.cpp
|
2022-05-07 16:11:00 +00:00
|
|
|
PROPERTIES COMPILE_FLAGS "-fno-tree-loop-distribution -fno-tree-loop-distribute-patterns")
|
|
|
|
|
2022-02-05 14:48:32 +00:00
|
|
|
add_link_options(LINKER:-z,pack-relative-relocs)
|
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)
|
2022-05-17 07:41:25 +00:00
|
|
|
elseif ("${SERENITY_ARCH}" STREQUAL "i686")
|
2021-07-13 14:43:45 +00:00
|
|
|
set_new_alignment(4)
|
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.
|
|
|
|
../AK/Format.cpp
|
|
|
|
../AK/StringBuilder.cpp
|
|
|
|
../Kernel/Arch/x86/${KERNEL_ARCH}/Processor.cpp
|
|
|
|
../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.
|
|
|
|
../Kernel/Arch/x86/common/Interrupts.cpp
|
|
|
|
../Kernel/Syscall.cpp
|
|
|
|
)
|
|
|
|
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)
|
|
|
|
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})
|
|
|
|
|
2021-07-18 12:47:32 +00:00
|
|
|
add_executable(Kernel ${SOURCES})
|
|
|
|
add_dependencies(Kernel generate_EscapeSequenceStateMachine.h)
|
2021-05-20 09:44:23 +00:00
|
|
|
|
2022-03-08 17:21:40 +00:00
|
|
|
if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/linker.ld
|
|
|
|
COMMAND "${CMAKE_CXX_COMPILER}" ${TARGET_STRING} -E -P -x c -I${CMAKE_CURRENT_SOURCE_DIR}/.. "${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/linker.ld" -o "${CMAKE_CURRENT_BINARY_DIR}/linker.ld"
|
|
|
|
MAIN_DEPENDENCY "Arch/x86/linker.ld"
|
|
|
|
COMMENT "Preprocessing linker.ld"
|
|
|
|
VERBATIM
|
|
|
|
)
|
2021-07-20 08:40:09 +00:00
|
|
|
|
2022-03-08 17:21:40 +00:00
|
|
|
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")
|
|
|
|
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 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()
|
|
|
|
|
2021-06-24 11:08:19 +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
|
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
|
|
|
|
2022-03-08 17:21:40 +00:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
embed_resource(Kernel serenity_boot_logo "Arch/aarch64/SerenityLogoRGB.ppm")
|
|
|
|
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
|
|
|
|
2022-03-08 17:21:40 +00:00
|
|
|
# aarch64 does not need a Prekernel
|
|
|
|
if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
|
|
add_subdirectory(Prekernel)
|
|
|
|
endif()
|