<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pub/teachos/kernel.git/kernel/kapi/memory.cpp, branch fmorgner/pcie-scan</title>
<subtitle>An educational OS kernel</subtitle>
<link rel='alternate' type='text/html' href='http://source.arknet.ch/pub/teachos/kernel.git/'/>
<entry>
<title>kapi/memory: replace mmio_region API with mmio_window</title>
<updated>2026-11-22T13:20:36+00:00</updated>
<author>
<name>Felix Morgner</name>
<email>felix.morgner@ost.ch</email>
</author>
<published>2026-11-16T09:20:33+00:00</published>
<link rel='alternate' type='text/html' href='http://source.arknet.ch/pub/teachos/kernel.git/commit/?id=45bf10f2ac489cc8253eb2f145c569edc16fc45a'/>
<id>45bf10f2ac489cc8253eb2f145c569edc16fc45a</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>kapi/memory: carry hw_base offset forward in mapping</title>
<updated>2026-11-22T13:20:36+00:00</updated>
<author>
<name>Felix Morgner</name>
<email>felix.morgner@ost.ch</email>
</author>
<published>2026-11-14T18:03:39+00:00</published>
<link rel='alternate' type='text/html' href='http://source.arknet.ch/pub/teachos/kernel.git/commit/?id=9a17b94c3cc3397152092da7f40a17682440fd78'/>
<id>9a17b94c3cc3397152092da7f40a17682440fd78</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>memory: harden MMIO mappings and update docs.</title>
<updated>2026-11-22T13:20:36+00:00</updated>
<author>
<name>Felix Morgner</name>
<email>felix.morgner@ost.ch</email>
</author>
<published>2026-11-14T16:54:57+00:00</published>
<link rel='alternate' type='text/html' href='http://source.arknet.ch/pub/teachos/kernel.git/commit/?id=dc5edf2193c14b17939ba9afe9eef4a907da053f'/>
<id>dc5edf2193c14b17939ba9afe9eef4a907da053f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>memory: improve MMIO allocation/mapping robustness</title>
<updated>2026-11-22T13:20:36+00:00</updated>
<author>
<name>Felix Morgner</name>
<email>felix.morgner@ost.ch</email>
</author>
<published>2026-11-14T16:20:53+00:00</published>
<link rel='alternate' type='text/html' href='http://source.arknet.ch/pub/teachos/kernel.git/commit/?id=1071297ee44d5102feb92b7a5d5ceb44e90622b7'/>
<id>1071297ee44d5102feb92b7a5d5ceb44e90622b7</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>kapi/memory: map MMIO regions more securely</title>
<updated>2026-11-22T13:20:36+00:00</updated>
<author>
<name>Felix Morgner</name>
<email>felix.morgner@ost.ch</email>
</author>
<published>2026-11-13T12:25:30+00:00</published>
<link rel='alternate' type='text/html' href='http://source.arknet.ch/pub/teachos/kernel.git/commit/?id=9a1f24148e2b61ef1f9d54c0285aba7213b14a0c'/>
<id>9a1f24148e2b61ef1f9d54c0285aba7213b14a0c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>kapi/memory: unmap MMIO regions on release</title>
<updated>2026-11-22T13:20:35+00:00</updated>
<author>
<name>Felix Morgner</name>
<email>felix.morgner@ost.ch</email>
</author>
<published>2026-11-13T10:48:29+00:00</published>
<link rel='alternate' type='text/html' href='http://source.arknet.ch/pub/teachos/kernel.git/commit/?id=e5c8bf2146bf17fe051f86708e7fd7f2b366b0ed'/>
<id>e5c8bf2146bf17fe051f86708e7fd7f2b366b0ed</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>kapi/memory: fix page unmap logic</title>
<updated>2026-11-22T13:20:35+00:00</updated>
<author>
<name>Felix Morgner</name>
<email>felix.morgner@ost.ch</email>
</author>
<published>2026-11-13T10:40:07+00:00</published>
<link rel='alternate' type='text/html' href='http://source.arknet.ch/pub/teachos/kernel.git/commit/?id=60ba364ec3c458b6bcf3d048781c8dd88937cd0e'/>
<id>60ba364ec3c458b6bcf3d048781c8dd88937cd0e</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>kernel: replace some more plain pointers</title>
<updated>2026-09-10T13:08:37+00:00</updated>
<author>
<name>Felix Morgner</name>
<email>felix.morgner@ost.ch</email>
</author>
<published>2026-09-10T13:08:37+00:00</published>
<link rel='alternate' type='text/html' href='http://source.arknet.ch/pub/teachos/kernel.git/commit/?id=3ce0197e99ecea7be66decc2c3c6f785497ef862'/>
<id>3ce0197e99ecea7be66decc2c3c6f785497ef862</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>x86_64: replace raw pointers with observer_ptr</title>
<updated>2026-09-10T06:53:57+00:00</updated>
<author>
<name>Felix Morgner</name>
<email>felix.morgner@ost.ch</email>
</author>
<published>2026-09-10T06:53:57+00:00</published>
<link rel='alternate' type='text/html' href='http://source.arknet.ch/pub/teachos/kernel.git/commit/?id=5449acc193f96d2ffaeb224aad5cea16bf753cdb'/>
<id>5449acc193f96d2ffaeb224aad5cea16bf753cdb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>chore: normalize panic messages</title>
<updated>2026-08-29T08:53:39+00:00</updated>
<author>
<name>Felix Morgner</name>
<email>felix.morgner@ost.ch</email>
</author>
<published>2026-08-29T08:53:39+00:00</published>
<link rel='alternate' type='text/html' href='http://source.arknet.ch/pub/teachos/kernel.git/commit/?id=0824a76b4f7294a74f4728084ca13070a4c8e7da'/>
<id>0824a76b4f7294a74f4728084ca13070a4c8e7da</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
