aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
23 hourskernel/devices: extract bus scanning implementationfmorgner/pcie-scanFelix Morgner10-50/+1008
This change extracts the PCI bus scanning logic, which previously was hidden inside an anonymous namespace, into a dedicated function. This allows for the implementation to be tested independently.
23 hourskernel/devices: introduce PCI function_infoFelix Morgner3-0/+211
Besides address information, each PCI function also has associated metadata. The function_info type carries the standard metadata for a PCI function: vendor and device IDs, the class code 3-tuple, and the header type. A bus scan reads those values when enumerating the PCI ECAM data, and returns it. The header type of the is stored in its raw form, encoding both the type of the PCI function header, as well as the multi-function flag. function_info provides two functions (type() and is_multifunction()) to extract those pieces of information from the raw header type value. In addition to the type extraction function, this change introduces an enumeration type (kernel::devices::pci::header_type) representing the standardized type values for PCI function headers. Unknown function types are presented as opaque values. Unit tests for derived attributes of a PCI function are provided.
23 hourskernel/devices: introduce PCI function_addressFelix Morgner2-0/+150
A PCI function is identified system-wide by its segment group, bus, device and function number. This identifier is represented by the new function_address type. It encapsulates the identifying 4-tuple (segment group, bus, device, function). This allows the kernel to reference a specific PCI function unambiguously within the system. The type is comparable and ordered by that tuple and formats as 'ssss:bb:dd.f'. The ordering is lexicographical based on the tuple (segment group, bus, device, function). Unit tests for the API surface of function_address are included.
23 hourskernel/devices: introduce PCI ecam_segment abstractionFelix Morgner11-129/+606
Previously, ECAM access was implemented "in-place" inside the PCI scan function. This meant that any checks were ad-hoc and not easily reusable or testable. Therefore, this change introduces a dedicated, reusable abstraction for ECAM segment access. It validates segment descriptors received from the platform and ensures no out-of-bounds buses are accessed at runtime. Construction of an ecam_segment will always succeed. If the firmware or platform data does not describe a valid segment, the ecam_segment will behave as if it had a size of zero, with a kernel log indicating the invalid segment. Attempting to map a bus that is out-of-bounds for a given ecam_segment will return a runtime error. If the system's MMIO space is insufficient to accommodate the mapping of a valid bus in an ecam_segment, a runtime error will be returned. Furthermore, this change introduces the kernel::devices::pci namespace. PCI initialization and scanning functionality, previously hosted in kernel/kernel/devices/pci_express.{cpp,hpp}, has been relocated and renamed to kernel/kernel/devices/pci/init.{cpp,hpp}. The initialization function of the PCI subsystem has been renamed from kernel::devices::init_pci_express_devices to kernel::devices::pci::init. The observable behavior of the PCI scan remains unchanged. Tests have been added to validate the behavior of ecam_segment against its contract.
23 hourskapi/memory: replace mmio_region API with mmio_windowFelix Morgner10-192/+818
Previously, allocation and mapping of MMIO regions was a multi-step process. The MMIO region API required its users to track and manage the lifetime of an MMIO region allocation manually. The new MMIO window API simplifies this by providing a single-step mapping interface and automatic lifetime management. Additionally, the new API adds strict bounds and alignment checks, to ensure that all MMIO accesses are within the requested range. The new API enforces these constraints at runtime via a system panic. Other contract violations, such as zero-sized mappings, are handled via runtime error codes. The new kapi::memory::mmio_window preserves the in-page offset of the hardware base within the window and bases all accesses on this offset. This means no user intervention is required to handle hardware ranges that are not aligned to a natural page boundary. The original pointer adjustment logic has been moved into the mmio_window class. Previous consumers of the region API (x86_64 LAPIC, PCIe) have been updated to the new mmio_window API. The behavior of the PCIe scan implementation has changed in that no windows are kept alive beyond the execution of the scan, since there are no consumers that would require persistent MMIO windows. Tests for the new infrastructure have been added, including a test support seam to allow for deinitialization of the MMIO subsystem in tests.
23 hourskapi/memory: add a destructor to mmio_allocatorFelix Morgner2-0/+13
In testing, the mmio_allocator gets replaced for every scenario requiring all heap allocations to be properly cleaned up before the replacement.
23 hourstests: add support for MMIO mappingFelix Morgner8-44/+233
23 hourskapi/memory: carry hw_base offset forward in mappingFelix Morgner2-4/+6
23 hoursmemory: harden MMIO mappings and update docs.Felix Morgner5-17/+50
23 hoursmemory: improve MMIO allocation/mapping robustnessFelix Morgner6-42/+104
23 hoursx86_64/memory: panic on huge page mappingsFelix Morgner1-0/+10
The x86_64 platform's higher half memory mapper currently has not support for huge page mappings. However, the previous implementation did not explicitly exclude huge page mappings, instead potentially corrupting the contents of huge pages by treating them as regular pages. The kernel now panics whenever an attempt is made to map a page inside a region covered by a huge page, or when trying to unmap a huge page or a range covered by a huge page.
23 hoursx86_64/memory: check leaf entry before unmappingFelix Morgner1-0/+8
23 hoursx86_64/memory: flush TLB on page unmapFelix Morgner2-1/+3
23 hourskapi/memory: map MMIO regions more securelyFelix Morgner1-1/+1
23 hoursdev/pcie: hide implementation detailsFelix Morgner2-54/+56
23 hoursdev/pcie: release absent MMIO regions during enumFelix Morgner1-9/+15
23 hourskapi/memory: unmap MMIO regions on releaseFelix Morgner1-0/+10
23 hourskapi/memory: fix page unmap logicFelix Morgner8-30/+62
Previously, the page mapper was expected to automatically free all frames that had become unused. However, this only works if all mappings refer to plain memory frames. In the case of MMIO frames, the mapper would still try to release the frame via the global frame allocator, which is incorrect, leading to undefined behavior in the worst case. This problem was discovered during work the PCI/PCIe subsystem, since we want to unmap any unused buses during enumeration.
23 hoursdev/pcie: introduce config space typeFelix Morgner2-8/+28
23 hoursx86_64/pcie: fix bus group numberFelix Morgner1-2/+2
23 hoursdev/pcie: extend segment descriptorFelix Morgner3-11/+28
23 hourstests: fix test buildFelix Morgner1-0/+13
23 hoursdev/pcie: implement basic enumeration algorithmFelix Morgner2-5/+72
23 hoursdev/pcie: implement initial detectionFelix Morgner8-0/+113
25 hourside: update devcontainer imageHEADdevelopFelix Morgner1-1/+1
25 hoursbuild: remove unused clang-tidy optionFelix Morgner1-23/+1
3 daysbuild: ensure clang-tidy uses the correct pathsFelix Morgner3-23/+54
Previously, clang-tidy would fall back to the global GCC toolchain and its include paths, meaning that any custom patches would be ignored. A partial solution had already been implemented for header checks, but the regular cpp file checks did not use the new flags. This change extracts the GCC toolchain location determination into the platform's CMake toolchain file and then applies those flags to both header and cpp file checks consistently.
10 daysagents: implement basic rules and skillsFelix Morgner6-0/+502
11 daysMerge branch 'fmorgner/acpi-extension-1' into 'develop'Felix Morgner26-133/+797
libs/acpi: implement MCFG table support See merge request teachos/kernel!72
11 daysbuild: fix test executablesFelix Morgner2-3/+14
11 dayscmake: clean up test target generationFelix Morgner1-86/+49
11 daysbuild: fix stress test linkingFelix Morgner1-2/+16
11 dayslibs/acpi: clean up MCFG entry reading codeFelix Morgner2-31/+25
11 dayslibs/acpi: don't convert addresses to pointerFelix Morgner8-19/+13
Previously, ACPI table addresses in both the RSDT and XSDT were converted to pointers. However, this is not actually correct, since within the object model of the kernel, pointers always refer to objects by their linear address, and the addresses encoded in ACPI tables are, by necessity, physical addresses. The API should therefore be honest about the fact that the addresses returned by accessors of the RSDT and XSDT are physical addresses, not pointers to live objects.
11 dayslibs/acpi: improve data docsFelix Morgner5-8/+99
11 dayslibs/acpi: improve common documentationFelix Morgner4-23/+183
11 dayslibs/acpi: improve vla_table interfaceFelix Morgner9-83/+221
11 dayslibs/acpi: extend MCFG table interfaceFelix Morgner7-21/+132
11 dayslibs/acpi: implement MCFG table supportFelix Morgner5-0/+160
11 dayslibs/acpi: add basic test data for MCFG tableFelix Morgner4-0/+28
11 daysMerge branch 'feature/catch2-string-makers-develop' into 'develop'Felix Morgner10-2/+488
kstd: add Catch2 string makers for printable test output source from develop branch See merge request teachos/kernel!69
11 daystest: apply review feedback for Catch2 string makersmanuel5-29/+27
- restrict the -include force-include flag to GCC and Clang - drop the redundant explicit include in the kernel string maker tests - apply clang-format Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 daysdoc: require StringMaker instead of formatter for test printingmanuel2-7/+6
11 daysdoc: describe how to make types printable in test failuresmanuel1-0/+10
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 dayskernel: add Catch2 string makers for printable test outputmanuel3-0/+197
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 dayskstd: add Catch2 string makers for printable test outputmanuel6-2/+284
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 daysbuild: fix aliasFelix Morgner2-1/+32
12 daysbuild: make sure clang-tidy picks up all sourcesFelix Morgner7-19/+65
2026-10-22ide: preinstall correct version of Catch2Felix Morgner1-1/+10
2026-10-05Merge branch 'fmorgner/implement-kstd-ring-buffer' into 'develop'Felix Morgner6-55/+4298
kstd: implement fixed-size ring_buffer This patchset introduces a (non-standard) container to the kernel standard library. The new container, `kstd::ring_buffer<T, N>`, is a fixed-size ring buffer, with an LRU overwrite policy. This means, that the size of the buffer is defined at compile-time. When a buffer is full, pushing further elements into it will replace existing ones in a Least Recently Used manner. The first target application of this new container is an extension to the existing logging system, providing a kernel log buffer. See merge request teachos/kernel!62