<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://tech-pubs.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Kernel%3A_malloc</id>
	<title>Kernel: malloc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://tech-pubs.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Kernel%3A_malloc"/>
	<link rel="alternate" type="text/html" href="http://tech-pubs.net/wiki/index.php?title=Kernel:_malloc&amp;action=history"/>
	<updated>2026-04-21T19:09:14Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>http://tech-pubs.net/wiki/index.php?title=Kernel:_malloc&amp;diff=478&amp;oldid=prev</id>
		<title>Raion: Raion moved page Kernel:malloc to Kernel: malloc without leaving a redirect: Misspelled title</title>
		<link rel="alternate" type="text/html" href="http://tech-pubs.net/wiki/index.php?title=Kernel:_malloc&amp;diff=478&amp;oldid=prev"/>
		<updated>2026-01-09T23:58:28Z</updated>

		<summary type="html">&lt;p&gt;Raion moved page &lt;a href=&quot;/wiki/index.php?title=Kernel:malloc&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Kernel:malloc (page does not exist)&quot;&gt;Kernel:malloc&lt;/a&gt; to &lt;a href=&quot;/wiki/index.php/Kernel:_malloc&quot; title=&quot;Kernel: malloc&quot;&gt;Kernel: malloc&lt;/a&gt; without leaving a redirect: Misspelled title&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:58, 9 January 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Raion</name></author>
	</entry>
	<entry>
		<id>http://tech-pubs.net/wiki/index.php?title=Kernel:_malloc&amp;diff=473&amp;oldid=prev</id>
		<title>Raion at 23:56, 9 January 2026</title>
		<link rel="alternate" type="text/html" href="http://tech-pubs.net/wiki/index.php?title=Kernel:_malloc&amp;diff=473&amp;oldid=prev"/>
		<updated>2026-01-09T23:56:26Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:56, 9 January 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l156&quot;&gt;Line 156:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 156:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Ensure that alignment and cache color are power-of-two values for correctness.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Ensure that alignment and cache color are power-of-two values for correctness.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Debug assertions (`ASSERT`) in IRIX should be converted to runtime checks or kernel asserts in the new environment.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Debug assertions (`ASSERT`) in IRIX should be converted to runtime checks or kernel asserts in the new environment.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category: Kernel Documentation]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Raion</name></author>
	</entry>
	<entry>
		<id>http://tech-pubs.net/wiki/index.php?title=Kernel:_malloc&amp;diff=444&amp;oldid=prev</id>
		<title>Raion at 20:54, 29 December 2025</title>
		<link rel="alternate" type="text/html" href="http://tech-pubs.net/wiki/index.php?title=Kernel:_malloc&amp;diff=444&amp;oldid=prev"/>
		<updated>2025-12-29T20:54:11Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:54, 29 December 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;= IRIX Kernel Memory Allocation: Functional Documentation =&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This page documents the memory allocation subsystem of the IRIX kernel (`malloc`, `rmalloc`, and related functions) as implemented in the IRIX kernel. It is intended as a functional reference for reimplementation in other kernels (e.g., Illumos).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This page documents the memory allocation subsystem of the IRIX kernel (`malloc`, `rmalloc`, and related functions) as implemented in the IRIX kernel. It is intended as a functional reference for reimplementation in other kernels (e.g., Illumos).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Raion</name></author>
	</entry>
	<entry>
		<id>http://tech-pubs.net/wiki/index.php?title=Kernel:_malloc&amp;diff=443&amp;oldid=prev</id>
		<title>Raion: Initial</title>
		<link rel="alternate" type="text/html" href="http://tech-pubs.net/wiki/index.php?title=Kernel:_malloc&amp;diff=443&amp;oldid=prev"/>
		<updated>2025-12-29T20:53:44Z</updated>

		<summary type="html">&lt;p&gt;Initial&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= IRIX Kernel Memory Allocation: Functional Documentation =&lt;br /&gt;
&lt;br /&gt;
This page documents the memory allocation subsystem of the IRIX kernel (`malloc`, `rmalloc`, and related functions) as implemented in the IRIX kernel. It is intended as a functional reference for reimplementation in other kernels (e.g., Illumos).&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
The IRIX memory allocation system provides:&lt;br /&gt;
&lt;br /&gt;
* Map-based memory management (`struct map`) for contiguous resource allocation.&lt;br /&gt;
* Page-aligned and color-aware allocations for cache efficiency (R4000-specific).&lt;br /&gt;
* Bitmap-based system page table (SPT) management.&lt;br /&gt;
* Waiting and non-waiting allocation paths (`VM_NOSLEEP` flag).&lt;br /&gt;
* Synchronization primitives using spinlocks and semaphores.&lt;br /&gt;
&lt;br /&gt;
Memory management in IRIX is based on two concepts:&lt;br /&gt;
&lt;br /&gt;
# **Maps** – contiguous resources tracked as a list of free/allocated blocks.&lt;br /&gt;
# **Bitmaps** – finer-grained allocation (e.g., pages, cache-colored pages) with alignment support.&lt;br /&gt;
&lt;br /&gt;
== Map Allocation API ==&lt;br /&gt;
&lt;br /&gt;
=== rmallocmap() ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Purpose:&amp;#039;&amp;#039;&amp;#039; Allocate and initialize a `struct map` for tracking resources.  &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Inputs:&amp;#039;&amp;#039;&amp;#039; `mapsiz` – number of entries in the map.  &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Outputs:&amp;#039;&amp;#039;&amp;#039; Pointer to newly allocated map, or NULL on failure.  &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Behavior:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* Allocates memory for `mapsiz + 2` map entries.&lt;br /&gt;
* Allocates and initializes a synchronization structure (`lock + semaphore`).&lt;br /&gt;
* Stores pointers to synchronization primitives in the second map entry.&lt;br /&gt;
* Returns a fully initialized map ready for allocations.&lt;br /&gt;
&lt;br /&gt;
=== rmfreemap() ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Purpose:&amp;#039;&amp;#039;&amp;#039; Free a previously allocated map.  &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Inputs:&amp;#039;&amp;#039;&amp;#039; Pointer to map.  &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Behavior:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* Waits for any threads currently blocked on the map.&lt;br /&gt;
* Destroys associated semaphore and spinlock.&lt;br /&gt;
* Frees both the map memory and the synchronization structure.&lt;br /&gt;
&lt;br /&gt;
=== malloc / malloc_wait / rmalloc / rmalloc_wait ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Purpose:&amp;#039;&amp;#039;&amp;#039; Allocate contiguous units from a map.  &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Inputs:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* `mp` – pointer to map&lt;br /&gt;
* `size` – number of units&lt;br /&gt;
* Optional `flags` (`VM_NOSLEEP` for non-blocking)&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Behavior:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* Uses **first-fit allocation**.&lt;br /&gt;
* Non-blocking (`VM_NOSLEEP`) returns `0` if allocation fails.&lt;br /&gt;
* Blocking waits on the map’s semaphore until space becomes available.&lt;br /&gt;
* Returns the starting address of allocated space.&lt;br /&gt;
&lt;br /&gt;
=== mfree / rmfree ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Purpose:&amp;#039;&amp;#039;&amp;#039; Free previously allocated space in a map.  &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Inputs:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* `mp` – pointer to map&lt;br /&gt;
* `size` – units to free&lt;br /&gt;
* `a` – base address&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Behavior:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* Sorts the freed block into the map.&lt;br /&gt;
* Merges with adjacent free blocks if possible.&lt;br /&gt;
* Updates map’s size and count.&lt;br /&gt;
* Broadcasts to any waiting threads if space becomes available.&lt;br /&gt;
* Logs warnings if map overflow or invalid free occurs.&lt;br /&gt;
&lt;br /&gt;
== Bitmap-Based Page Table Management ==&lt;br /&gt;
&lt;br /&gt;
The IRIX kernel uses **bitmap structures** to manage system page tables (`spt`). This allows fine-grained allocation with support for color and alignment.&lt;br /&gt;
&lt;br /&gt;
=== sptalloc() ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Purpose:&amp;#039;&amp;#039;&amp;#039; Allocate pages from the system page table bitmap.  &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Inputs:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* `bm` – pointer to system bitmap structure&lt;br /&gt;
* `want` – number of pages&lt;br /&gt;
* `flags` – allocation flags (`VM_NOSLEEP`, `VM_VACOLOR`, `VM_BREAKABLE`)&lt;br /&gt;
* `color` – desired cache color (for R4000)&lt;br /&gt;
* `alignment` – page boundary alignment (power of 2)&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Behavior:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* Selects a bitmap (clean, stale, aged) for allocation.&lt;br /&gt;
* If color-specific allocation is requested, attempts color map first.&lt;br /&gt;
* Uses rotors to track possible starting positions for efficiency.&lt;br /&gt;
* Supports alignment constraints.&lt;br /&gt;
* Will optionally wait (blocking) if pages are unavailable.&lt;br /&gt;
* Updates bitmap counters and rotors on allocation.&lt;br /&gt;
&lt;br /&gt;
=== sptfree() ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Purpose:&amp;#039;&amp;#039;&amp;#039; Free pages back to the system page table bitmap.  &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Inputs:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* `bm` – pointer to system bitmap&lt;br /&gt;
* `size` – number of pages&lt;br /&gt;
* `mapaddr` – base address of pages to free&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Behavior:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* Updates `m_lowbit`, `m_highbit`, and `m_count` in the bitmap.&lt;br /&gt;
* Sets freed bits in the bitmap.&lt;br /&gt;
* Broadcasts to waiting threads.&lt;br /&gt;
&lt;br /&gt;
=== mergebitmaps() ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Purpose:&amp;#039;&amp;#039;&amp;#039; Merge one bitmap into another (e.g., stale pages back into main SPT map).  &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Inputs:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* `bm` – system bitmap&lt;br /&gt;
* `to` – destination bitmap&lt;br /&gt;
* `from` – source bitmap&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Behavior:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* Copies set bits from source to destination.&lt;br /&gt;
* Updates rotor information for SPT allocation.&lt;br /&gt;
* Clears source bitmap.&lt;br /&gt;
&lt;br /&gt;
=== bmapswtch() ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Purpose:&amp;#039;&amp;#039;&amp;#039; Swap contents of two bitmaps.  &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Use case:&amp;#039;&amp;#039;&amp;#039; Replace an old bitmap with a new one without modifying allocation state.&lt;br /&gt;
&lt;br /&gt;
=== sptgetsizes() ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Purpose:&amp;#039;&amp;#039;&amp;#039; Get counts of pages in different states (clean, stale, aged, in-transit).&lt;br /&gt;
&lt;br /&gt;
== Synchronization and Multi-Processor Considerations ==&lt;br /&gt;
&lt;br /&gt;
* Spinlocks (`mutex_spinlock`) protect map structures during allocation.&lt;br /&gt;
* Bitmaps have a hierarchy of locks:&lt;br /&gt;
** Normal allocation lock (`MAP_ALLOCLOCK`)**&lt;br /&gt;
** Urgent lock (`MAP_URGENTLOCK`)** – signals to other threads to back off during replenishment.&lt;br /&gt;
* Wait queues (semaphores) are used for threads blocked on resources.&lt;br /&gt;
&lt;br /&gt;
== R4000-Specific Enhancements ==&lt;br /&gt;
&lt;br /&gt;
* **Cache-colored allocation:** ensures pages allocated from a bitmap minimize cache conflicts.&lt;br /&gt;
* **sptvctst()** – tests for a free bit in a specific cache color.&lt;br /&gt;
* **color_alloc()** – allocates a page of a specific color.&lt;br /&gt;
* **sptaligntst()** – ensures alignment in allocations.&lt;br /&gt;
&lt;br /&gt;
== Fault Checking ==&lt;br /&gt;
&lt;br /&gt;
* `kvfaultcheck()` inspects which CPUs have references to aged or temporary pages.&lt;br /&gt;
* Returns a CPU mask indicating CPUs that need TLB flushes.&lt;br /&gt;
* Integration with isolate debugging on multi-CPU systems (EVEREST/SN0).&lt;br /&gt;
&lt;br /&gt;
== Notes for Reimplementation ==&lt;br /&gt;
&lt;br /&gt;
* Map-based allocations are generic and can be adapted to other OS kernels.&lt;br /&gt;
* Bitmap-based page allocations depend on low-level page tables; rotors and color optimizations can be implemented optionally.&lt;br /&gt;
* Careful handling of spinlocks, semaphores, and wait queues is required in multi-processor environments.&lt;br /&gt;
* Ensure that alignment and cache color are power-of-two values for correctness.&lt;br /&gt;
* Debug assertions (`ASSERT`) in IRIX should be converted to runtime checks or kernel asserts in the new environment.&lt;/div&gt;</summary>
		<author><name>Raion</name></author>
	</entry>
</feed>