feat: rename 'ZenithOS' => 'MontaukOS' and fix build system issues

This commit is contained in:
2026-02-28 12:06:18 +01:00
parent 1809ae55e5
commit 83016847b4
136 changed files with 1669 additions and 51769 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ ARCH := x86_64
# Default user QEMU flags. These are appended to the QEMU command calls. # Default user QEMU flags. These are appended to the QEMU command calls.
QEMUFLAGS := -m 2G -d int -D qemu.log QEMUFLAGS := -m 2G -d int -D qemu.log
override IMAGE_NAME := os220-$(ARCH) override IMAGE_NAME := montauk-$(ARCH)
# Toolchain for building the 'limine' executable for the host. # Toolchain for building the 'limine' executable for the host.
HOST_CC := cc HOST_CC := cc
+3 -3
View File
@@ -1,4 +1,4 @@
# The ZenithOS Operating System # The MontaukOS Operating System
ZenithOS is a hobbyist operating system written in modern C++. It runs on bare metal and supports various applications, including DOOM, a Wikipedia client, and standard desktop utilities. MontaukOS is a hobbyist operating system written in modern C++. It runs on bare metal and supports various applications, including DOOM, a Wikipedia client, and standard desktop utilities.
![ZenithOS screenshot](images/ZenithOS.png) ![MontaukOS screenshot](images/MontaukOS.png)
+3 -3
View File
@@ -1,4 +1,4 @@
# Building ZenithOS # Building MontaukOS
## Build Dependencies ## Build Dependencies
@@ -43,8 +43,8 @@ sudo apt install build-essential nasm git curl xorriso mtools gdisk qemu-system-
1. Clone the repository: 1. Clone the repository:
```bash ```bash
git clone https://github.com/danihamm/ZenithOS.git git clone https://github.com/danihamm/MontaukOS.git
cd ZenithOS cd MontaukOS
``` ```
2. Build the ISO: 2. Build the ISO:
+71 -71
View File
@@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ZenithOS &mdash; Userspace Application Development</title> <title>MontaukOS &mdash; Userspace Application Development</title>
<style> <style>
:root { :root {
--bg: #ffffff; --bg: #ffffff;
@@ -218,7 +218,7 @@
<!-- SIDEBAR --> <!-- SIDEBAR -->
<!-- ================================================================= --> <!-- ================================================================= -->
<nav class="sidebar"> <nav class="sidebar">
<h2>ZenithOS Docs</h2> <h2>MontaukOS Docs</h2>
<ul> <ul>
<li><a href="#overview">Overview</a></li> <li><a href="#overview">Overview</a></li>
<li><a href="#getting-started">Getting Started</a> <li><a href="#getting-started">Getting Started</a>
@@ -272,7 +272,7 @@
<!-- ------ Overview ------ --> <!-- ------ Overview ------ -->
<h1 id="overview">Userspace Developer's Handbook</h1> <h1 id="overview">Userspace Developer's Handbook</h1>
<p> <p>
ZenithOS is a hobbyist 64-bit operating system written in C++20. MontaukOS is a hobbyist 64-bit operating system written in C++20.
Userspace programs run in Ring&nbsp;3, are loaded as static ELF64 Userspace programs run in Ring&nbsp;3, are loaded as static ELF64
binaries, and communicate with the kernel through the x86-64 binaries, and communicate with the kernel through the x86-64
<code>SYSCALL</code>/<code>SYSRET</code> mechanism. <code>SYSCALL</code>/<code>SYSRET</code> mechanism.
@@ -294,7 +294,7 @@
&#x251C;&#x2500;&#x2500; include/ &#x251C;&#x2500;&#x2500; include/
&#x2502; &#x251C;&#x2500;&#x2500; Api/ &#x2502; &#x251C;&#x2500;&#x2500; Api/
&#x2502; &#x2502; &#x2514;&#x2500;&#x2500; Syscall.hpp # Syscall numbers &amp; data structures &#x2502; &#x2502; &#x2514;&#x2500;&#x2500; Syscall.hpp # Syscall numbers &amp; data structures
&#x2502; &#x251C;&#x2500;&#x2500; zenith/ &#x2502; &#x251C;&#x2500;&#x2500; montauk/
&#x2502; &#x2502; &#x251C;&#x2500;&#x2500; syscall.h # Inline asm wrappers &amp; typed API &#x2502; &#x2502; &#x251C;&#x2500;&#x2500; syscall.h # Inline asm wrappers &amp; typed API
&#x2502; &#x2502; &#x2514;&#x2500;&#x2500; heap.h # Userspace heap allocator (malloc/mfree/realloc) &#x2502; &#x2502; &#x2514;&#x2500;&#x2500; heap.h # Userspace heap allocator (malloc/mfree/realloc)
&#x2502; &#x2514;&#x2500;&#x2500; libc/ # Minimal C standard library headers &#x2502; &#x2514;&#x2500;&#x2500; libc/ # Minimal C standard library headers
@@ -311,7 +311,7 @@
&#x2502; &#x2502; &#x2514;&#x2500;&#x2500; main.cpp # Manual page viewer &#x2502; &#x2502; &#x2514;&#x2500;&#x2500; main.cpp # Manual page viewer
&#x2502; &#x2514;&#x2500;&#x2500; doom/ &#x2502; &#x2514;&#x2500;&#x2500; doom/
&#x2502; &#x251C;&#x2500;&#x2500; Makefile # DOOM build system &#x2502; &#x251C;&#x2500;&#x2500; Makefile # DOOM build system
&#x2502; &#x251C;&#x2500;&#x2500; doomgeneric_zenith.c # ZenithOS platform layer &#x2502; &#x251C;&#x2500;&#x2500; doomgeneric_montauk.c # MontaukOS platform layer
&#x2502; &#x2514;&#x2500;&#x2500; libc.c # C library implementation &#x2502; &#x2514;&#x2500;&#x2500; libc.c # C library implementation
&#x251C;&#x2500;&#x2500; bin/ # Compiled .elf binaries &#x251C;&#x2500;&#x2500; bin/ # Compiled .elf binaries
&#x2514;&#x2500;&#x2500; obj/ # Intermediate object files</code></pre> &#x2514;&#x2500;&#x2500; obj/ # Intermediate object files</code></pre>
@@ -387,19 +387,19 @@ make # or: make -j$(nproc)</code></pre>
<strong>Auto-exit:</strong> If <code>_start()</code> returns normally, <strong>Auto-exit:</strong> If <code>_start()</code> returns normally,
the kernel's exit stub (mapped at <code>0x3FF000</code>) automatically the kernel's exit stub (mapped at <code>0x3FF000</code>) automatically
calls <code>SYS_EXIT(0)</code>. You can also call calls <code>SYS_EXIT(0)</code>. You can also call
<code>zenith::exit(code)</code> explicitly at any point. <code>montauk::exit(code)</code> explicitly at any point.
</div> </div>
<h3 id="hello-world">Hello World</h3> <h3 id="hello-world">Hello World</h3>
<p class="file-path">programs/src/hello/main.cpp</p> <p class="file-path">programs/src/hello/main.cpp</p>
<pre><code><span style="color:#8b949e">// Minimal ZenithOS userspace program</span> <pre><code><span style="color:#8b949e">// Minimal MontaukOS userspace program</span>
#include &lt;zenith/syscall.h&gt; #include &lt;montauk/syscall.h&gt;
extern "C" void _start() { extern "C" void _start() {
zenith::print("Hello from userspace!\n"); montauk::print("Hello from userspace!\n");
}</code></pre> }</code></pre>
<p> <p>
Include <code>&lt;zenith/syscall.h&gt;</code> for the full typed API. Include <code>&lt;montauk/syscall.h&gt;</code> for the full typed API.
That header pulls in <code>&lt;Api/Syscall.hpp&gt;</code> for That header pulls in <code>&lt;Api/Syscall.hpp&gt;</code> for
constants and data structures. constants and data structures.
</p> </p>
@@ -409,7 +409,7 @@ extern "C" void _start() {
<h3 id="calling-convention">Calling Convention</h3> <h3 id="calling-convention">Calling Convention</h3>
<p> <p>
ZenithOS uses the hardware <code>SYSCALL</code> instruction on MontaukOS uses the hardware <code>SYSCALL</code> instruction on
x86-64. The kernel sets up the required MSRs x86-64. The kernel sets up the required MSRs
(<code>IA32_STAR</code>, <code>IA32_LSTAR</code>, (<code>IA32_STAR</code>, <code>IA32_LSTAR</code>,
<code>IA32_FMASK</code>) during boot. <code>IA32_FMASK</code>) during boot.
@@ -440,7 +440,7 @@ extern "C" void _start() {
</p> </p>
<h3 id="raw-wrappers">Raw Syscall Wrappers</h3> <h3 id="raw-wrappers">Raw Syscall Wrappers</h3>
<p class="file-path">programs/include/zenith/syscall.h</p> <p class="file-path">programs/include/montauk/syscall.h</p>
<p> <p>
Seven inline functions cover 0&ndash;6 argument syscalls: Seven inline functions cover 0&ndash;6 argument syscalls:
</p> </p>
@@ -459,7 +459,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
<h3 id="typed-wrappers">Typed API Wrappers</h3> <h3 id="typed-wrappers">Typed API Wrappers</h3>
<p> <p>
The <code>zenith::</code> namespace provides type-safe wrappers around The <code>montauk::</code> namespace provides type-safe wrappers around
the raw syscalls. These are the recommended interface for application the raw syscalls. These are the recommended interface for application
code. The full reference follows below. code. The full reference follows below.
</p> </p>
@@ -467,7 +467,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
<!-- ================================================================= --> <!-- ================================================================= -->
<h2 id="syscall-ref">Syscall Reference</h2> <h2 id="syscall-ref">Syscall Reference</h2>
<p> <p>
ZenithOS v0.1.0 exposes <strong>26 syscalls</strong> (numbers MontaukOS v0.1.0 exposes <strong>26 syscalls</strong> (numbers
0&ndash;25), organized into 10 categories. 0&ndash;25), organized into 10 categories.
</p> </p>
@@ -475,7 +475,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
<h3 id="cat-process"><span class="badge badge-process">Process</span> Process Management</h3> <h3 id="cat-process"><span class="badge badge-process">Process</span> Process Management</h3>
<h4 id="sys-exit"><code>SYS_EXIT</code> (0) &mdash; Terminate the current process</h4> <h4 id="sys-exit"><code>SYS_EXIT</code> (0) &mdash; Terminate the current process</h4>
<pre><code><span class="sig">[[noreturn]] void zenith::exit(int code = 0);</span></code></pre> <pre><code><span class="sig">[[noreturn]] void montauk::exit(int code = 0);</span></code></pre>
<p> <p>
Terminates the calling process. The exit code is currently unused by Terminates the calling process. The exit code is currently unused by
the kernel but reserved for future wait/status support. the kernel but reserved for future wait/status support.
@@ -483,28 +483,28 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
</p> </p>
<h4 id="sys-yield"><code>SYS_YIELD</code> (1) &mdash; Yield the CPU</h4> <h4 id="sys-yield"><code>SYS_YIELD</code> (1) &mdash; Yield the CPU</h4>
<pre><code><span class="sig">void zenith::yield();</span></code></pre> <pre><code><span class="sig">void montauk::yield();</span></code></pre>
<p> <p>
Voluntarily yields the remainder of the current time slice, allowing Voluntarily yields the remainder of the current time slice, allowing
the scheduler to run another ready process immediately. the scheduler to run another ready process immediately.
</p> </p>
<h4 id="sys-sleep-ms"><code>SYS_SLEEP_MS</code> (2) &mdash; Sleep for a duration</h4> <h4 id="sys-sleep-ms"><code>SYS_SLEEP_MS</code> (2) &mdash; Sleep for a duration</h4>
<pre><code><span class="sig">void zenith::sleep_ms(uint64_t ms);</span></code></pre> <pre><code><span class="sig">void montauk::sleep_ms(uint64_t ms);</span></code></pre>
<p> <p>
Suspends the calling process for at least <code>ms</code> Suspends the calling process for at least <code>ms</code>
milliseconds. Resolution depends on the APIC timer tick rate. milliseconds. Resolution depends on the APIC timer tick rate.
</p> </p>
<h4 id="sys-getpid"><code>SYS_GETPID</code> (3) &mdash; Get process ID</h4> <h4 id="sys-getpid"><code>SYS_GETPID</code> (3) &mdash; Get process ID</h4>
<pre><code><span class="sig">int zenith::getpid();</span></code></pre> <pre><code><span class="sig">int montauk::getpid();</span></code></pre>
<p> <p>
Returns the PID of the calling process. Returns <code>-1</code> if Returns the PID of the calling process. Returns <code>-1</code> if
called from the idle context (should not happen in userspace). called from the idle context (should not happen in userspace).
</p> </p>
<h4 id="sys-spawn"><code>SYS_SPAWN</code> (20) &mdash; Spawn a new process</h4> <h4 id="sys-spawn"><code>SYS_SPAWN</code> (20) &mdash; Spawn a new process</h4>
<pre><code><span class="sig">int zenith::spawn(const char* path, const char* args = nullptr);</span></code></pre> <pre><code><span class="sig">int montauk::spawn(const char* path, const char* args = nullptr);</span></code></pre>
<p> <p>
Loads the ELF binary at <code>path</code> (a VFS path like Loads the ELF binary at <code>path</code> (a VFS path like
<code>"0:/hello.elf"</code>) and spawns it as a new process. <code>"0:/hello.elf"</code>) and spawns it as a new process.
@@ -516,7 +516,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
</p> </p>
<h4 id="sys-waitpid"><code>SYS_WAITPID</code> (23) &mdash; Wait for a process to exit</h4> <h4 id="sys-waitpid"><code>SYS_WAITPID</code> (23) &mdash; Wait for a process to exit</h4>
<pre><code><span class="sig">void zenith::waitpid(int pid);</span></code></pre> <pre><code><span class="sig">void montauk::waitpid(int pid);</span></code></pre>
<p> <p>
Blocks the calling process until the process identified by Blocks the calling process until the process identified by
<code>pid</code> has exited. Internally yields the CPU in a loop <code>pid</code> has exited. Internally yields the CPU in a loop
@@ -527,7 +527,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
</p> </p>
<h4 id="sys-getargs"><code>SYS_GETARGS</code> (25) &mdash; Get process arguments</h4> <h4 id="sys-getargs"><code>SYS_GETARGS</code> (25) &mdash; Get process arguments</h4>
<pre><code><span class="sig">int zenith::getargs(char* buf, uint64_t maxLen);</span></code></pre> <pre><code><span class="sig">int montauk::getargs(char* buf, uint64_t maxLen);</span></code></pre>
<p> <p>
Copies the argument string passed to the current process (via Copies the argument string passed to the current process (via
<code>spawn()</code>) into <code>buf</code>, writing at most <code>spawn()</code>) into <code>buf</code>, writing at most
@@ -540,14 +540,14 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
<h3 id="cat-console"><span class="badge badge-console">Console</span> Console I/O</h3> <h3 id="cat-console"><span class="badge badge-console">Console</span> Console I/O</h3>
<h4 id="sys-print"><code>SYS_PRINT</code> (4) &mdash; Print a string</h4> <h4 id="sys-print"><code>SYS_PRINT</code> (4) &mdash; Print a string</h4>
<pre><code><span class="sig">void zenith::print(const char* text);</span></code></pre> <pre><code><span class="sig">void montauk::print(const char* text);</span></code></pre>
<p> <p>
Writes a null-terminated string to the kernel terminal. Supports Writes a null-terminated string to the kernel terminal. Supports
newlines (<code>\n</code>) and standard printable ASCII. newlines (<code>\n</code>) and standard printable ASCII.
</p> </p>
<h4 id="sys-putchar"><code>SYS_PUTCHAR</code> (5) &mdash; Print a single character</h4> <h4 id="sys-putchar"><code>SYS_PUTCHAR</code> (5) &mdash; Print a single character</h4>
<pre><code><span class="sig">void zenith::putchar(char c);</span></code></pre> <pre><code><span class="sig">void montauk::putchar(char c);</span></code></pre>
<p> <p>
Writes a single character to the kernel terminal. Useful for building Writes a single character to the kernel terminal. Useful for building
output character by character (e.g.&nbsp;printing integers). output character by character (e.g.&nbsp;printing integers).
@@ -557,7 +557,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
<h3 id="cat-fileio"><span class="badge badge-fileio">File I/O</span> File I/O</h3> <h3 id="cat-fileio"><span class="badge badge-fileio">File I/O</span> File I/O</h3>
<h4 id="sys-open"><code>SYS_OPEN</code> (6) &mdash; Open a file</h4> <h4 id="sys-open"><code>SYS_OPEN</code> (6) &mdash; Open a file</h4>
<pre><code><span class="sig">int zenith::open(const char* path);</span></code></pre> <pre><code><span class="sig">int montauk::open(const char* path);</span></code></pre>
<p> <p>
Opens a file on the VFS. Paths use the format Opens a file on the VFS. Paths use the format
<code>"&lt;device&gt;:/&lt;name&gt;"</code> (e.g.&nbsp;<code>"0:/hello.elf"</code> <code>"&lt;device&gt;:/&lt;name&gt;"</code> (e.g.&nbsp;<code>"0:/hello.elf"</code>
@@ -566,7 +566,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
</p> </p>
<h4 id="sys-read"><code>SYS_READ</code> (7) &mdash; Read from a file</h4> <h4 id="sys-read"><code>SYS_READ</code> (7) &mdash; Read from a file</h4>
<pre><code><span class="sig">int zenith::read(int handle, uint8_t* buf, uint64_t offset, uint64_t size);</span></code></pre> <pre><code><span class="sig">int montauk::read(int handle, uint8_t* buf, uint64_t offset, uint64_t size);</span></code></pre>
<p> <p>
Reads up to <code>size</code> bytes from the file at the given byte Reads up to <code>size</code> bytes from the file at the given byte
<code>offset</code> into <code>buf</code>. Returns the number of bytes <code>offset</code> into <code>buf</code>. Returns the number of bytes
@@ -575,15 +575,15 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
</p> </p>
<h4 id="sys-getsize"><code>SYS_GETSIZE</code> (8) &mdash; Get file size</h4> <h4 id="sys-getsize"><code>SYS_GETSIZE</code> (8) &mdash; Get file size</h4>
<pre><code><span class="sig">uint64_t zenith::getsize(int handle);</span></code></pre> <pre><code><span class="sig">uint64_t montauk::getsize(int handle);</span></code></pre>
<p>Returns the total size (in bytes) of the file associated with <code>handle</code>.</p> <p>Returns the total size (in bytes) of the file associated with <code>handle</code>.</p>
<h4 id="sys-close"><code>SYS_CLOSE</code> (9) &mdash; Close a file</h4> <h4 id="sys-close"><code>SYS_CLOSE</code> (9) &mdash; Close a file</h4>
<pre><code><span class="sig">void zenith::close(int handle);</span></code></pre> <pre><code><span class="sig">void montauk::close(int handle);</span></code></pre>
<p>Closes the file handle and releases associated kernel resources.</p> <p>Closes the file handle and releases associated kernel resources.</p>
<h4 id="sys-readdir"><code>SYS_READDIR</code> (10) &mdash; List directory entries</h4> <h4 id="sys-readdir"><code>SYS_READDIR</code> (10) &mdash; List directory entries</h4>
<pre><code><span class="sig">int zenith::readdir(const char* path, const char** names, int max);</span></code></pre> <pre><code><span class="sig">int montauk::readdir(const char* path, const char** names, int max);</span></code></pre>
<p> <p>
Reads up to <code>max</code> directory entries from <code>path</code>. Reads up to <code>max</code> directory entries from <code>path</code>.
Entry name pointers are written into the <code>names</code> array. Entry name pointers are written into the <code>names</code> array.
@@ -602,16 +602,16 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
</p> </p>
<h4>Userspace Heap (recommended)</h4> <h4>Userspace Heap (recommended)</h4>
<p class="file-path">programs/include/zenith/heap.h</p> <p class="file-path">programs/include/montauk/heap.h</p>
<p> <p>
Include <code>&lt;zenith/heap.h&gt;</code> for a proper free-list Include <code>&lt;montauk/heap.h&gt;</code> for a proper free-list
allocator that runs entirely in userspace. It calls allocator that runs entirely in userspace. It calls
<code>SYS_ALLOC</code> internally to obtain pages and manages <code>SYS_ALLOC</code> internally to obtain pages and manages
sub-page allocations with a linked free list &mdash; adapted from sub-page allocations with a linked free list &mdash; adapted from
the kernel's own <code>HeapAllocator</code>. the kernel's own <code>HeapAllocator</code>.
</p> </p>
<pre><code><span class="sig">void* zenith::malloc(uint64_t size);</span></code></pre> <pre><code><span class="sig">void* montauk::malloc(uint64_t size);</span></code></pre>
<p> <p>
Allocates <code>size</code> bytes from the userspace free list. Allocates <code>size</code> bytes from the userspace free list.
Returns a 16-byte-aligned pointer, or <code>nullptr</code> on failure. Returns a 16-byte-aligned pointer, or <code>nullptr</code> on failure.
@@ -619,7 +619,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
from the kernel via <code>SYS_ALLOC</code> (minimum 16&nbsp;KiB growth). from the kernel via <code>SYS_ALLOC</code> (minimum 16&nbsp;KiB growth).
</p> </p>
<pre><code><span class="sig">void zenith::mfree(void* ptr);</span></code></pre> <pre><code><span class="sig">void montauk::mfree(void* ptr);</span></code></pre>
<p> <p>
Returns the block to the userspace free list. Returns the block to the userspace free list.
<strong>No syscall is made</strong> &mdash; the memory stays mapped <strong>No syscall is made</strong> &mdash; the memory stays mapped
@@ -627,7 +627,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
Passing <code>nullptr</code> is a safe no-op. Passing <code>nullptr</code> is a safe no-op.
</p> </p>
<pre><code><span class="sig">void* zenith::realloc(void* ptr, uint64_t size);</span></code></pre> <pre><code><span class="sig">void* montauk::realloc(void* ptr, uint64_t size);</span></code></pre>
<p> <p>
Resizes the allocation at <code>ptr</code> to <code>size</code> bytes. Resizes the allocation at <code>ptr</code> to <code>size</code> bytes.
Allocates a new block, copies the smaller of old/new sizes, and frees Allocates a new block, copies the smaller of old/new sizes, and frees
@@ -638,37 +638,37 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
<h4>Low-Level Page Syscalls</h4> <h4>Low-Level Page Syscalls</h4>
<h4 id="sys-alloc"><code>SYS_ALLOC</code> (11) &mdash; Map pages</h4> <h4 id="sys-alloc"><code>SYS_ALLOC</code> (11) &mdash; Map pages</h4>
<pre><code><span class="sig">void* zenith::alloc(uint64_t size);</span></code></pre> <pre><code><span class="sig">void* montauk::alloc(uint64_t size);</span></code></pre>
<p> <p>
Maps <code>size</code> bytes of zeroed physical pages into the Maps <code>size</code> bytes of zeroed physical pages into the
process's address space (starting at <code>0x40000000</code>). process's address space (starting at <code>0x40000000</code>).
The size is rounded up to the nearest page boundary (4&nbsp;KiB). The size is rounded up to the nearest page boundary (4&nbsp;KiB).
Returns a pointer to the mapped region, or <code>nullptr</code> on Returns a pointer to the mapped region, or <code>nullptr</code> on
failure. This is the backing primitive for failure. This is the backing primitive for
<code>zenith::malloc</code> &mdash; most programs should use the heap <code>montauk::malloc</code> &mdash; most programs should use the heap
API instead of calling this directly. API instead of calling this directly.
</p> </p>
<h4 id="sys-free"><code>SYS_FREE</code> (12) &mdash; Unmap pages (no-op)</h4> <h4 id="sys-free"><code>SYS_FREE</code> (12) &mdash; Unmap pages (no-op)</h4>
<pre><code><span class="sig">void zenith::free(void* ptr);</span></code></pre> <pre><code><span class="sig">void montauk::free(void* ptr);</span></code></pre>
<p> <p>
Reserved for future page-level unmapping. Currently a no-op &mdash; Reserved for future page-level unmapping. Currently a no-op &mdash;
pages are reclaimed when the process exits. Use pages are reclaimed when the process exits. Use
<code>zenith::mfree</code> for heap allocations. <code>montauk::mfree</code> for heap allocations.
</p> </p>
<!-- ---- Timekeeping ---- --> <!-- ---- Timekeeping ---- -->
<h3 id="cat-time"><span class="badge badge-time">Time</span> Timekeeping</h3> <h3 id="cat-time"><span class="badge badge-time">Time</span> Timekeeping</h3>
<h4 id="sys-getticks"><code>SYS_GETTICKS</code> (13) &mdash; Get tick count</h4> <h4 id="sys-getticks"><code>SYS_GETTICKS</code> (13) &mdash; Get tick count</h4>
<pre><code><span class="sig">uint64_t zenith::get_ticks();</span></code></pre> <pre><code><span class="sig">uint64_t montauk::get_ticks();</span></code></pre>
<p> <p>
Returns the number of APIC timer ticks since boot. The tick rate Returns the number of APIC timer ticks since boot. The tick rate
depends on the hardware and APIC timer calibration. depends on the hardware and APIC timer calibration.
</p> </p>
<h4 id="sys-getmilliseconds"><code>SYS_GETMILLISECONDS</code> (14) &mdash; Get milliseconds since boot</h4> <h4 id="sys-getmilliseconds"><code>SYS_GETMILLISECONDS</code> (14) &mdash; Get milliseconds since boot</h4>
<pre><code><span class="sig">uint64_t zenith::get_milliseconds();</span></code></pre> <pre><code><span class="sig">uint64_t montauk::get_milliseconds();</span></code></pre>
<p> <p>
Returns wall-clock milliseconds elapsed since boot. Useful for Returns wall-clock milliseconds elapsed since boot. Useful for
calculating uptime or measuring durations. calculating uptime or measuring durations.
@@ -678,7 +678,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
<h3 id="cat-system"><span class="badge badge-system">System</span> System Information</h3> <h3 id="cat-system"><span class="badge badge-system">System</span> System Information</h3>
<h4 id="sys-getinfo"><code>SYS_GETINFO</code> (15) &mdash; Get OS information</h4> <h4 id="sys-getinfo"><code>SYS_GETINFO</code> (15) &mdash; Get OS information</h4>
<pre><code><span class="sig">void zenith::get_info(Zenith::SysInfo* info);</span></code></pre> <pre><code><span class="sig">void montauk::get_info(Montauk::SysInfo* info);</span></code></pre>
<p> <p>
Fills in a <a href="#struct-sysinfo"><code>SysInfo</code></a> structure Fills in a <a href="#struct-sysinfo"><code>SysInfo</code></a> structure
with the OS name, version string, API version number, and maximum with the OS name, version string, API version number, and maximum
@@ -689,14 +689,14 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
<h3 id="cat-keyboard"><span class="badge badge-keyboard">Keyboard</span> Keyboard Input</h3> <h3 id="cat-keyboard"><span class="badge badge-keyboard">Keyboard</span> Keyboard Input</h3>
<h4 id="sys-iskeyavailable"><code>SYS_ISKEYAVAILABLE</code> (16) &mdash; Check for pending key</h4> <h4 id="sys-iskeyavailable"><code>SYS_ISKEYAVAILABLE</code> (16) &mdash; Check for pending key</h4>
<pre><code><span class="sig">bool zenith::is_key_available();</span></code></pre> <pre><code><span class="sig">bool montauk::is_key_available();</span></code></pre>
<p> <p>
Returns <code>true</code> if a key event is available in the PS/2 Returns <code>true</code> if a key event is available in the PS/2
keyboard buffer. Non-blocking. keyboard buffer. Non-blocking.
</p> </p>
<h4 id="sys-getkey"><code>SYS_GETKEY</code> (17) &mdash; Get a key event</h4> <h4 id="sys-getkey"><code>SYS_GETKEY</code> (17) &mdash; Get a key event</h4>
<pre><code><span class="sig">void zenith::getkey(Zenith::KeyEvent* out);</span></code></pre> <pre><code><span class="sig">void montauk::getkey(Montauk::KeyEvent* out);</span></code></pre>
<p> <p>
Fills in a <a href="#struct-keyevent"><code>KeyEvent</code></a> Fills in a <a href="#struct-keyevent"><code>KeyEvent</code></a>
structure with the next keyboard event (press or release), including structure with the next keyboard event (press or release), including
@@ -704,7 +704,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
</p> </p>
<h4 id="sys-getchar"><code>SYS_GETCHAR</code> (18) &mdash; Read a character (blocking)</h4> <h4 id="sys-getchar"><code>SYS_GETCHAR</code> (18) &mdash; Read a character (blocking)</h4>
<pre><code><span class="sig">char zenith::getchar();</span></code></pre> <pre><code><span class="sig">char montauk::getchar();</span></code></pre>
<p> <p>
Blocks until a printable character key-press is available, then Blocks until a printable character key-press is available, then
returns the ASCII character. This is the simplest way to read returns the ASCII character. This is the simplest way to read
@@ -715,7 +715,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
<h3 id="cat-network"><span class="badge badge-network">Network</span> Networking</h3> <h3 id="cat-network"><span class="badge badge-network">Network</span> Networking</h3>
<h4 id="sys-ping"><code>SYS_PING</code> (19) &mdash; Send an ICMP echo request</h4> <h4 id="sys-ping"><code>SYS_PING</code> (19) &mdash; Send an ICMP echo request</h4>
<pre><code><span class="sig">int32_t zenith::ping(uint32_t ip, uint32_t timeoutMs = 3000);</span></code></pre> <pre><code><span class="sig">int32_t montauk::ping(uint32_t ip, uint32_t timeoutMs = 3000);</span></code></pre>
<p> <p>
Sends an ICMP echo request to <code>ip</code> and waits up to Sends an ICMP echo request to <code>ip</code> and waits up to
<code>timeoutMs</code> milliseconds for a reply. The IP address is in <code>timeoutMs</code> milliseconds for a reply. The IP address is in
@@ -729,7 +729,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
<h3 id="cat-framebuffer"><span class="badge badge-framebuf">Framebuffer</span> Framebuffer Access</h3> <h3 id="cat-framebuffer"><span class="badge badge-framebuf">Framebuffer</span> Framebuffer Access</h3>
<h4 id="sys-fbinfo"><code>SYS_FBINFO</code> (21) &mdash; Get framebuffer information</h4> <h4 id="sys-fbinfo"><code>SYS_FBINFO</code> (21) &mdash; Get framebuffer information</h4>
<pre><code><span class="sig">void zenith::fb_info(Zenith::FbInfo* info);</span></code></pre> <pre><code><span class="sig">void montauk::fb_info(Montauk::FbInfo* info);</span></code></pre>
<p> <p>
Fills in a <a href="#struct-fbinfo"><code>FbInfo</code></a> structure Fills in a <a href="#struct-fbinfo"><code>FbInfo</code></a> structure
with the framebuffer dimensions, pitch (bytes per scanline), and with the framebuffer dimensions, pitch (bytes per scanline), and
@@ -738,7 +738,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
</p> </p>
<h4 id="sys-fbmap"><code>SYS_FBMAP</code> (22) &mdash; Map framebuffer into process memory</h4> <h4 id="sys-fbmap"><code>SYS_FBMAP</code> (22) &mdash; Map framebuffer into process memory</h4>
<pre><code><span class="sig">void* zenith::fb_map();</span></code></pre> <pre><code><span class="sig">void* montauk::fb_map();</span></code></pre>
<p> <p>
Maps the physical framebuffer into the calling process's address Maps the physical framebuffer into the calling process's address
space at <code>0x50000000</code> and returns the user virtual address. space at <code>0x50000000</code> and returns the user virtual address.
@@ -756,7 +756,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
<h3 id="cat-terminal"><span class="badge badge-system">Terminal</span> Terminal</h3> <h3 id="cat-terminal"><span class="badge badge-system">Terminal</span> Terminal</h3>
<h4 id="sys-termsize"><code>SYS_TERMSIZE</code> (24) &mdash; Get terminal dimensions</h4> <h4 id="sys-termsize"><code>SYS_TERMSIZE</code> (24) &mdash; Get terminal dimensions</h4>
<pre><code><span class="sig">void zenith::termsize(int* cols, int* rows);</span></code></pre> <pre><code><span class="sig">void montauk::termsize(int* cols, int* rows);</span></code></pre>
<p> <p>
Returns the current terminal dimensions (character grid) via the Returns the current terminal dimensions (character grid) via the
two output pointers. Columns are packed in the low 32&nbsp;bits and two output pointers. Columns are packed in the low 32&nbsp;bits and
@@ -768,16 +768,16 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
<!-- ================================================================= --> <!-- ================================================================= -->
<h2 id="data-structures">Data Structures</h2> <h2 id="data-structures">Data Structures</h2>
<h3 id="struct-sysinfo"><code>Zenith::SysInfo</code></h3> <h3 id="struct-sysinfo"><code>Montauk::SysInfo</code></h3>
<p class="file-path">programs/include/Api/Syscall.hpp</p> <p class="file-path">programs/include/Api/Syscall.hpp</p>
<pre><code>struct SysInfo { <pre><code>struct SysInfo {
char osName[32]; <span style="color:#8b949e">// e.g. "ZenithOS"</span> char osName[32]; <span style="color:#8b949e">// e.g. "MontaukOS"</span>
char osVersion[32]; <span style="color:#8b949e">// e.g. "0.1.0"</span> char osVersion[32]; <span style="color:#8b949e">// e.g. "0.1.0"</span>
uint32_t apiVersion; <span style="color:#8b949e">// Current: 2</span> uint32_t apiVersion; <span style="color:#8b949e">// Current: 2</span>
uint32_t maxProcesses; <span style="color:#8b949e">// Current: 16</span> uint32_t maxProcesses; <span style="color:#8b949e">// Current: 16</span>
};</code></pre> };</code></pre>
<h3 id="struct-fbinfo"><code>Zenith::FbInfo</code></h3> <h3 id="struct-fbinfo"><code>Montauk::FbInfo</code></h3>
<pre><code>struct FbInfo { <pre><code>struct FbInfo {
uint64_t width; <span style="color:#8b949e">// Framebuffer width in pixels</span> uint64_t width; <span style="color:#8b949e">// Framebuffer width in pixels</span>
uint64_t height; <span style="color:#8b949e">// Framebuffer height in pixels</span> uint64_t height; <span style="color:#8b949e">// Framebuffer height in pixels</span>
@@ -786,7 +786,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
uint64_t userAddr; <span style="color:#8b949e">// Reserved (0 until mapped via SYS_FBMAP)</span> uint64_t userAddr; <span style="color:#8b949e">// Reserved (0 until mapped via SYS_FBMAP)</span>
};</code></pre> };</code></pre>
<h3 id="struct-keyevent"><code>Zenith::KeyEvent</code></h3> <h3 id="struct-keyevent"><code>Montauk::KeyEvent</code></h3>
<pre><code>struct KeyEvent { <pre><code>struct KeyEvent {
uint8_t scancode; <span style="color:#8b949e">// Raw PS/2 scancode</span> uint8_t scancode; <span style="color:#8b949e">// Raw PS/2 scancode</span>
char ascii; <span style="color:#8b949e">// Translated ASCII character (0 if non-printable)</span> char ascii; <span style="color:#8b949e">// Translated ASCII character (0 if non-printable)</span>
@@ -796,7 +796,7 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
bool alt; <span style="color:#8b949e">// Alt modifier active</span> bool alt; <span style="color:#8b949e">// Alt modifier active</span>
};</code></pre> };</code></pre>
<h3 id="struct-syscallframe"><code>Zenith::SyscallFrame</code> (kernel only)</h3> <h3 id="struct-syscallframe"><code>Montauk::SyscallFrame</code> (kernel only)</h3>
<pre><code>struct SyscallFrame { <pre><code>struct SyscallFrame {
uint64_t r15, r14, r13, r12, rbp, rbx; <span style="color:#8b949e">// callee-saved</span> uint64_t r15, r14, r13, r12, rbp, rbx; <span style="color:#8b949e">// callee-saved</span>
uint64_t arg6, arg5, arg4, arg3, arg2, arg1; uint64_t arg6, arg5, arg4, arg3, arg2, arg1;
@@ -813,26 +813,26 @@ int64_t syscall6(uint64_t nr, uint64_t a1, ..., uint64_t a6);</code></pre>
<h2 id="shell-walkthrough">Shell Application Walkthrough</h2> <h2 id="shell-walkthrough">Shell Application Walkthrough</h2>
<p class="file-path">programs/src/shell/main.cpp</p> <p class="file-path">programs/src/shell/main.cpp</p>
<p> <p>
The built-in shell is the best example of a real ZenithOS application. The built-in shell is the best example of a real MontaukOS application.
It demonstrates most of the available syscalls. It demonstrates most of the available syscalls.
</p> </p>
<h3>Initialization</h3> <h3>Initialization</h3>
<pre><code>extern "C" void _start() { <pre><code>extern "C" void _start() {
zenith::print("\n ZenithOS Shell v0.1\n"); montauk::print("\n MontaukOS Shell v0.1\n");
zenith::print(" Type 'help' for available commands.\n\n"); montauk::print(" Type 'help' for available commands.\n\n");
char line[256]; char line[256];
int pos = 0; int pos = 0;
prompt(); prompt();
while (true) { while (true) {
char c = zenith::getchar(); <span style="color:#8b949e">// blocking read</span> char c = montauk::getchar(); <span style="color:#8b949e">// blocking read</span>
<span style="color:#8b949e">// ... handle input, echo, backspace ...</span> <span style="color:#8b949e">// ... handle input, echo, backspace ...</span>
} }
}</code></pre> }</code></pre>
<p> <p>
The shell uses <code>zenith::getchar()</code> in a loop for blocking The shell uses <code>montauk::getchar()</code> in a loop for blocking
character-by-character input, manually handling echo and backspace. character-by-character input, manually handling echo and backspace.
</p> </p>
@@ -898,11 +898,11 @@ char path[128];
<span style="color:#8b949e">// ... copy "0:/" + filename into path ...</span> <span style="color:#8b949e">// ... copy "0:/" + filename into path ...</span>
<span style="color:#8b949e">// 2. Open</span> <span style="color:#8b949e">// 2. Open</span>
int handle = zenith::open(path); int handle = montauk::open(path);
if (handle &lt; 0) { <span style="color:#8b949e">/* error */</span> return; } if (handle &lt; 0) { <span style="color:#8b949e">/* error */</span> return; }
<span style="color:#8b949e">// 3. Get size</span> <span style="color:#8b949e">// 3. Get size</span>
uint64_t size = zenith::getsize(handle); uint64_t size = montauk::getsize(handle);
<span style="color:#8b949e">// 4. Read in chunks</span> <span style="color:#8b949e">// 4. Read in chunks</span>
uint8_t buf[512]; uint8_t buf[512];
@@ -910,15 +910,15 @@ uint64_t offset = 0;
while (offset &lt; size) { while (offset &lt; size) {
uint64_t chunk = size - offset; uint64_t chunk = size - offset;
if (chunk &gt; sizeof(buf) - 1) chunk = sizeof(buf) - 1; if (chunk &gt; sizeof(buf) - 1) chunk = sizeof(buf) - 1;
int bytesRead = zenith::read(handle, buf, offset, chunk); int bytesRead = montauk::read(handle, buf, offset, chunk);
if (bytesRead &lt;= 0) break; if (bytesRead &lt;= 0) break;
buf[bytesRead] = '\0'; buf[bytesRead] = '\0';
zenith::print((const char*)buf); montauk::print((const char*)buf);
offset += bytesRead; offset += bytesRead;
} }
<span style="color:#8b949e">// 5. Close</span> <span style="color:#8b949e">// 5. Close</span>
zenith::close(handle);</code></pre> montauk::close(handle);</code></pre>
<h3>Pattern: IP Networking</h3> <h3>Pattern: IP Networking</h3>
<pre><code><span style="color:#8b949e">// Parse "10.0.2.2" into uint32_t in little-endian order</span> <pre><code><span style="color:#8b949e">// Parse "10.0.2.2" into uint32_t in little-endian order</span>
@@ -927,10 +927,10 @@ parse_ip("10.0.2.2", &amp;ip); <span style="color:#8b949e">// ip = 0x0202000A</
<span style="color:#8b949e">// Send 4 pings with 1-second intervals</span> <span style="color:#8b949e">// Send 4 pings with 1-second intervals</span>
for (int i = 0; i &lt; 4; i++) { for (int i = 0; i &lt; 4; i++) {
int32_t rtt = zenith::ping(ip, 3000); int32_t rtt = montauk::ping(ip, 3000);
if (rtt &lt; 0) { <span style="color:#8b949e">/* timeout */</span> } if (rtt &lt; 0) { <span style="color:#8b949e">/* timeout */</span> }
else { <span style="color:#8b949e">/* reply in rtt ms */</span> } else { <span style="color:#8b949e">/* reply in rtt ms */</span> }
if (i &lt; 3) zenith::sleep_ms(1000); if (i &lt; 3) montauk::sleep_ms(1000);
}</code></pre> }</code></pre>
<!-- ================================================================= --> <!-- ================================================================= -->
@@ -975,9 +975,9 @@ for (int i = 0; i &lt; 4; i++) {
</p> </p>
<h3>Step 4: Add a Typed Userspace Wrapper</h3> <h3>Step 4: Add a Typed Userspace Wrapper</h3>
<p class="file-path">programs/include/zenith/syscall.h</p> <p class="file-path">programs/include/montauk/syscall.h</p>
<pre><code>inline int64_t my_func(uint64_t arg1, const char* arg2) { <pre><code>inline int64_t my_func(uint64_t arg1, const char* arg2) {
return syscall2(Zenith::SYS_MYFUNC, arg1, (uint64_t)arg2); return syscall2(Montauk::SYS_MYFUNC, arg1, (uint64_t)arg2);
}</code></pre> }</code></pre>
<p> <p>
Choose the appropriate <code>syscallN</code> variant based on the Choose the appropriate <code>syscallN</code> variant based on the
@@ -999,7 +999,7 @@ Kt::KernelLogStream(Kt::OK, "Syscall") &lt;&lt; "SYSCALL/SYSRET initialized (LST
<tr><td>1</td><td><code>kernel/src/Api/Syscall.hpp</code></td><td>Add <code>SYS_MYFUNC</code> constant (+ any new structs)</td></tr> <tr><td>1</td><td><code>kernel/src/Api/Syscall.hpp</code></td><td>Add <code>SYS_MYFUNC</code> constant (+ any new structs)</td></tr>
<tr><td>2</td><td><code>kernel/src/Api/Syscall.cpp</code></td><td>Add <code>Sys_MyFunc()</code> implementation + dispatch case</td></tr> <tr><td>2</td><td><code>kernel/src/Api/Syscall.cpp</code></td><td>Add <code>Sys_MyFunc()</code> implementation + dispatch case</td></tr>
<tr><td>3</td><td><code>programs/include/Api/Syscall.hpp</code></td><td>Add matching <code>SYS_MYFUNC</code> constant (+ any new structs)</td></tr> <tr><td>3</td><td><code>programs/include/Api/Syscall.hpp</code></td><td>Add matching <code>SYS_MYFUNC</code> constant (+ any new structs)</td></tr>
<tr><td>4</td><td><code>programs/include/zenith/syscall.h</code></td><td>Add typed wrapper in <code>zenith::</code> namespace</td></tr> <tr><td>4</td><td><code>programs/include/montauk/syscall.h</code></td><td>Add typed wrapper in <code>montauk::</code> namespace</td></tr>
<tr><td>5</td><td><em>(optional)</em></td><td>Update syscall count in boot log</td></tr> <tr><td>5</td><td><em>(optional)</em></td><td>Update syscall count in boot log</td></tr>
</table> </table>
@@ -1032,13 +1032,13 @@ Kt::KernelLogStream(Kt::OK, "Syscall") &lt;&lt; "SYSCALL/SYSRET initialized (LST
<code>stdlib.h</code>, and <code>string.h</code>.</li> <code>stdlib.h</code>, and <code>string.h</code>.</li>
<li><strong>No dynamic linking</strong> &mdash; all programs are statically linked.</li> <li><strong>No dynamic linking</strong> &mdash; all programs are statically linked.</li>
<li><strong>No argc/argv</strong> &mdash; <code>_start</code> receives no <li><strong>No argc/argv</strong> &mdash; <code>_start</code> receives no
<code>argc</code>/<code>argv</code>. Use <code>zenith::getargs()</code> <code>argc</code>/<code>argv</code>. Use <code>montauk::getargs()</code>
to retrieve a single argument string (max 255 chars) passed via to retrieve a single argument string (max 255 chars) passed via
<code>zenith::spawn()</code>.</li> <code>montauk::spawn()</code>.</li>
<li><strong>No page-level <code>free()</code></strong> &mdash; <li><strong>No page-level <code>free()</code></strong> &mdash;
<code>SYS_FREE</code> is a no-op; pages mapped via <code>SYS_ALLOC</code> <code>SYS_FREE</code> is a no-op; pages mapped via <code>SYS_ALLOC</code>
are only reclaimed when the process exits. However, the userspace heap are only reclaimed when the process exits. However, the userspace heap
(<code>zenith::malloc</code>/<code>zenith::mfree</code>) does reuse (<code>montauk::malloc</code>/<code>montauk::mfree</code>) does reuse
memory via a free list.</li> memory via a free list.</li>
<li><strong>16 process slots</strong> &mdash; the scheduler supports a <li><strong>16 process slots</strong> &mdash; the scheduler supports a
maximum of 16 concurrent processes.</li> maximum of 16 concurrent processes.</li>
@@ -1054,7 +1054,7 @@ Kt::KernelLogStream(Kt::OK, "Syscall") &lt;&lt; "SYSCALL/SYSRET initialized (LST
<hr> <hr>
<p style="color:var(--fg-muted); font-size:.85rem; margin-top:2rem;"> <p style="color:var(--fg-muted); font-size:.85rem; margin-top:2rem;">
ZenithOS Documentation &mdash; Copyright &copy; 2025-2026 Daniel Hammer MontaukOS Documentation &mdash; Copyright &copy; 2025-2026 Daniel Hammer
</p> </p>
</main> </main>
+1 -1
View File
@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <Sched/Scheduler.hpp> #include <Sched/Scheduler.hpp>
namespace Zenith { namespace Montauk {
// Find the process that owns the I/O ring buffers for a redirected process. // Find the process that owns the I/O ring buffers for a redirected process.
// If proc owns buffers itself (spawned via spawn_redir), returns proc. // If proc owns buffers itself (spawned via spawn_redir), returns proc.
// If proc inherited redirection (spawned via spawn from a redirected parent), // If proc inherited redirection (spawned via spawn from a redirected parent),
+1 -1
View File
@@ -16,7 +16,7 @@
#include "Syscall.hpp" #include "Syscall.hpp"
namespace Zenith { namespace Montauk {
static void dl_strcpy(char* dst, const char* src, int max) { static void dl_strcpy(char* dst, const char* src, int max) {
int i = 0; int i = 0;
+1 -1
View File
@@ -13,7 +13,7 @@
#include <Memory/Paging.hpp> #include <Memory/Paging.hpp>
#include <Libraries/Memory.hpp> #include <Libraries/Memory.hpp>
namespace Zenith { namespace Montauk {
static int Sys_Open(const char* path) { static int Sys_Open(const char* path) {
return Fs::Vfs::VfsOpen(path); return Fs::Vfs::VfsOpen(path);
} }
+1 -1
View File
@@ -16,7 +16,7 @@
#include "Common.hpp" #include "Common.hpp"
#include "../Libraries/flanterm/src/flanterm.h" #include "../Libraries/flanterm/src/flanterm.h"
namespace Zenith { namespace Montauk {
static void Sys_FbInfo(FbInfo* out) { static void Sys_FbInfo(FbInfo* out) {
if (out == nullptr) return; if (out == nullptr) return;
+1 -1
View File
@@ -10,7 +10,7 @@
#include <Memory/HHDM.hpp> #include <Memory/HHDM.hpp>
#include <Memory/PageFrameAllocator.hpp> #include <Memory/PageFrameAllocator.hpp>
namespace Zenith { namespace Montauk {
// Per-process heap allocation tracking (separate from Process struct to avoid bloating it) // Per-process heap allocation tracking (separate from Process struct to avoid bloating it)
struct HeapAlloc { struct HeapAlloc {
+3 -3
View File
@@ -9,16 +9,16 @@
#include "Syscall.hpp" #include "Syscall.hpp"
namespace Zenith { namespace Montauk {
static void Sys_GetInfo(SysInfo* outInfo) { static void Sys_GetInfo(SysInfo* outInfo) {
if (outInfo == nullptr) return; if (outInfo == nullptr) return;
// Copy strings into fixed-size arrays (user-accessible) // Copy strings into fixed-size arrays (user-accessible)
const char* name = "ZenithOS"; const char* name = "MontaukOS";
const char* ver = "0.1.0"; const char* ver = "0.1.0";
for (int i = 0; name[i]; i++) outInfo->osName[i] = name[i]; for (int i = 0; name[i]; i++) outInfo->osName[i] = name[i];
outInfo->osName[8] = '\0'; outInfo->osName[9] = '\0';
for (int i = 0; ver[i]; i++) outInfo->osVersion[i] = ver[i]; for (int i = 0; ver[i]; i++) outInfo->osVersion[i] = ver[i];
outInfo->osVersion[5] = '\0'; outInfo->osVersion[5] = '\0';
+1 -1
View File
@@ -12,7 +12,7 @@
#include "Syscall.hpp" #include "Syscall.hpp"
#include "Common.hpp" #include "Common.hpp"
namespace Zenith { namespace Montauk {
static int Sys_SpawnRedir(const char* path, const char* args) { static int Sys_SpawnRedir(const char* path, const char* args) {
int childPid = Sched::Spawn(path, args); int childPid = Sched::Spawn(path, args);
+1 -1
View File
@@ -10,7 +10,7 @@
#include "Common.hpp" #include "Common.hpp"
namespace Zenith { namespace Montauk {
static bool Sys_IsKeyAvailable() { static bool Sys_IsKeyAvailable() {
auto* proc = Sched::GetCurrentProcessPtr(); auto* proc = Sched::GetCurrentProcessPtr();
if (proc && proc->redirected) { if (proc && proc->redirected) {
+1 -1
View File
@@ -9,7 +9,7 @@
#include "Syscall.hpp" #include "Syscall.hpp"
namespace Zenith { namespace Montauk {
static void Sys_MemStats(MemStats* out) { static void Sys_MemStats(MemStats* out) {
if (out == nullptr) return; if (out == nullptr) return;
+1 -1
View File
@@ -9,7 +9,7 @@
#include "Syscall.hpp" #include "Syscall.hpp"
namespace Zenith { namespace Montauk {
static void Sys_MouseState(MouseState* out) { static void Sys_MouseState(MouseState* out) {
if (out == nullptr) return; if (out == nullptr) return;
+1 -1
View File
@@ -19,7 +19,7 @@
#include "Syscall.hpp" #include "Syscall.hpp"
namespace Zenith { namespace Montauk {
static uint16_t g_pingSeq = 0; static uint16_t g_pingSeq = 0;
static constexpr uint16_t PING_ID = 0x2E01; // "ZE" static constexpr uint16_t PING_ID = 0x2E01; // "ZE"
+1 -1
View File
@@ -9,7 +9,7 @@
#include <Efi/UEFI.hpp> #include <Efi/UEFI.hpp>
#include <Memory/Paging.hpp> #include <Memory/Paging.hpp>
namespace Zenith { namespace Montauk {
static void Sys_Reset() { static void Sys_Reset() {
if (Efi::g_ResetSystem) { if (Efi::g_ResetSystem) {
+1 -1
View File
@@ -15,7 +15,7 @@
#include "Syscall.hpp" #include "Syscall.hpp"
#include "WinServer.hpp" #include "WinServer.hpp"
namespace Zenith { namespace Montauk {
static void Sys_Exit(int exitCode) { static void Sys_Exit(int exitCode) {
(void)exitCode; (void)exitCode;
Sched::ExitProcess(); Sched::ExitProcess();
+1 -1
View File
@@ -7,7 +7,7 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
namespace Zenith { namespace Montauk {
// ---- Random number generation ---- // ---- Random number generation ----
// Uses RDTSC mixed with xorshift64* PRNG for entropy. // Uses RDTSC mixed with xorshift64* PRNG for entropy.
+1 -1
View File
@@ -33,7 +33,7 @@
// Assembly entry point // Assembly entry point
extern "C" void SyscallEntry(); extern "C" void SyscallEntry();
namespace Zenith { namespace Montauk {
// ---- Dispatch ---- // ---- Dispatch ----
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Syscall.hpp * Syscall.hpp
* ZenithOS syscall definitions -- shared between kernel and programs * MontaukOS syscall definitions -- shared between kernel and programs
* Copyright (c) 2025 Daniel Hammer * Copyright (c) 2025 Daniel Hammer
*/ */
@@ -8,7 +8,7 @@
#include <cstdint> #include <cstdint>
#include <cstddef> #include <cstddef>
namespace Zenith { namespace Montauk {
// Syscall numbers // Syscall numbers
+1 -1
View File
@@ -10,7 +10,7 @@
#include "Common.hpp" #include "Common.hpp"
namespace Zenith { namespace Montauk {
static void Sys_Print(const char* text) { static void Sys_Print(const char* text) {
auto* proc = Sched::GetCurrentProcessPtr(); auto* proc = Sched::GetCurrentProcessPtr();
+1 -1
View File
@@ -10,7 +10,7 @@
#include "Syscall.hpp" #include "Syscall.hpp"
namespace Zenith { namespace Montauk {
static uint64_t Sys_GetTicks() { static uint64_t Sys_GetTicks() {
return Timekeeping::GetTicks(); return Timekeeping::GetTicks();
} }
+5 -5
View File
@@ -98,7 +98,7 @@ namespace WinServer {
return 0; return 0;
} }
int Poll(int windowId, int callerPid, Zenith::WinEvent* outEvent) { int Poll(int windowId, int callerPid, Montauk::WinEvent* outEvent) {
if (windowId < 0 || windowId >= MaxWindows) return -1; if (windowId < 0 || windowId >= MaxWindows) return -1;
WindowSlot& slot = g_slots[windowId]; WindowSlot& slot = g_slots[windowId];
if (!slot.used || slot.ownerPid != callerPid) return -1; if (!slot.used || slot.ownerPid != callerPid) return -1;
@@ -110,11 +110,11 @@ namespace WinServer {
return 1; return 1;
} }
int Enumerate(Zenith::WinInfo* outArray, int maxCount) { int Enumerate(Montauk::WinInfo* outArray, int maxCount) {
int count = 0; int count = 0;
for (int i = 0; i < MaxWindows && count < maxCount; i++) { for (int i = 0; i < MaxWindows && count < maxCount; i++) {
if (!g_slots[i].used) continue; if (!g_slots[i].used) continue;
Zenith::WinInfo& info = outArray[count]; Montauk::WinInfo& info = outArray[count];
info.id = i; info.id = i;
info.ownerPid = g_slots[i].ownerPid; info.ownerPid = g_slots[i].ownerPid;
for (int j = 0; j < 64; j++) info.title[j] = g_slots[i].title[j]; for (int j = 0; j < 64; j++) info.title[j] = g_slots[i].title[j];
@@ -151,7 +151,7 @@ namespace WinServer {
return userVa; return userVa;
} }
int SendEvent(int windowId, const Zenith::WinEvent* event) { int SendEvent(int windowId, const Montauk::WinEvent* event) {
if (windowId < 0 || windowId >= MaxWindows) return -1; if (windowId < 0 || windowId >= MaxWindows) return -1;
WindowSlot& slot = g_slots[windowId]; WindowSlot& slot = g_slots[windowId];
if (!slot.used) return -1; if (!slot.used) return -1;
@@ -209,7 +209,7 @@ namespace WinServer {
g_uiScale = scale; g_uiScale = scale;
// Broadcast scale event to all active windows // Broadcast scale event to all active windows
Zenith::WinEvent ev; Montauk::WinEvent ev;
memset(&ev, 0, sizeof(ev)); memset(&ev, 0, sizeof(ev));
ev.type = 4; ev.type = 4;
ev.scale.scale = scale; ev.scale.scale = scale;
+4 -4
View File
@@ -24,7 +24,7 @@ namespace WinServer {
uint64_t ownerVa; // VA in owner's address space uint64_t ownerVa; // VA in owner's address space
uint64_t desktopVa; // VA in desktop's address space (0 = not yet mapped) uint64_t desktopVa; // VA in desktop's address space (0 = not yet mapped)
int desktopPid; // PID of the process that mapped it int desktopPid; // PID of the process that mapped it
Zenith::WinEvent events[MaxEvents]; Montauk::WinEvent events[MaxEvents];
int eventHead, eventTail; int eventHead, eventTail;
bool dirty; bool dirty;
}; };
@@ -33,10 +33,10 @@ namespace WinServer {
uint64_t& heapNext, uint64_t& outVa); uint64_t& heapNext, uint64_t& outVa);
int Destroy(int windowId, int callerPid); int Destroy(int windowId, int callerPid);
int Present(int windowId, int callerPid); int Present(int windowId, int callerPid);
int Poll(int windowId, int callerPid, Zenith::WinEvent* outEvent); int Poll(int windowId, int callerPid, Montauk::WinEvent* outEvent);
int Enumerate(Zenith::WinInfo* outArray, int maxCount); int Enumerate(Montauk::WinInfo* outArray, int maxCount);
uint64_t Map(int windowId, int callerPid, uint64_t callerPml4, uint64_t& heapNext); uint64_t Map(int windowId, int callerPid, uint64_t callerPml4, uint64_t& heapNext);
int SendEvent(int windowId, const Zenith::WinEvent* event); int SendEvent(int windowId, const Montauk::WinEvent* event);
int Resize(int windowId, int callerPid, uint64_t ownerPml4, int newW, int newH, int Resize(int windowId, int callerPid, uint64_t ownerPml4, int newW, int newH,
uint64_t& heapNext, uint64_t& outVa); uint64_t& heapNext, uint64_t& outVa);
void CleanupProcess(int pid); void CleanupProcess(int pid);
+1 -1
View File
@@ -12,7 +12,7 @@
#include "Syscall.hpp" #include "Syscall.hpp"
#include "WinServer.hpp" #include "WinServer.hpp"
namespace Zenith { namespace Montauk {
static int Sys_WinCreate(const char* title, int w, int h, WinCreateResult* result) { static int Sys_WinCreate(const char* title, int w, int h, WinCreateResult* result) {
if (result == nullptr || title == nullptr) return -1; if (result == nullptr || title == nullptr) return -1;
+1 -1
View File
@@ -248,7 +248,7 @@ extern "C" void kmain() {
Fs::Vfs::RegisterDrive(0, &ramdiskDriver); Fs::Vfs::RegisterDrive(0, &ramdiskDriver);
Hal::LoadTSS(); Hal::LoadTSS();
Zenith::InitializeSyscalls(); Montauk::InitializeSyscalls();
Sched::Initialize(); Sched::Initialize();
+1 -1
View File
@@ -124,7 +124,7 @@ namespace Memory {
} }
} }
void PageFrameAllocator::GetStats(Zenith::MemStats* out) { void PageFrameAllocator::GetStats(Montauk::MemStats* out) {
if (!out) return; if (!out) return;
Lock.Acquire(); Lock.Acquire();
uint64_t freeBytes = 0; uint64_t freeBytes = 0;
+1 -1
View File
@@ -29,7 +29,7 @@ public:
void Free(void* ptr); void Free(void* ptr);
void Free(void* ptr, int n); void Free(void* ptr, int n);
void GetStats(Zenith::MemStats* out); void GetStats(Montauk::MemStats* out);
}; };
extern PageFrameAllocator* g_pfa; extern PageFrameAllocator* g_pfa;
+1 -1
View File
@@ -50,7 +50,7 @@ namespace Sched {
uint8_t* inBuf = nullptr; // 4KB ring: parent writes, child reads (getchar) uint8_t* inBuf = nullptr; // 4KB ring: parent writes, child reads (getchar)
uint32_t inHead = 0; uint32_t inHead = 0;
uint32_t inTail = 0; uint32_t inTail = 0;
Zenith::KeyEvent keyBuf[64]; // parent injects, child reads (getkey/iskeyavailable) Montauk::KeyEvent keyBuf[64]; // parent injects, child reads (getkey/iskeyavailable)
uint32_t keyHead = 0; uint32_t keyHead = 0;
uint32_t keyTail = 0; uint32_t keyTail = 0;
static constexpr uint32_t IoBufSize = 4096; static constexpr uint32_t IoBufSize = 4096;
+1 -1
View File
@@ -76,7 +76,7 @@ namespace Kt {
bool *glyph = &fbctx->font_bool[c->c * fbctx->font_height * fbctx->font_width]; bool *glyph = &fbctx->font_bool[c->c * fbctx->font_height * fbctx->font_width];
// Only ROTATE_0 is used in ZenithOS // Only ROTATE_0 is used in MontaukOS
volatile uint32_t *dest = fbctx->framebuffer + x + y * (fbctx->pitch / 4); volatile uint32_t *dest = fbctx->framebuffer + x + y * (fbctx->pitch / 4);
size_t stride = fbctx->pitch / 4; size_t stride = fbctx->pitch / 4;
+1 -1
View File
@@ -2,7 +2,7 @@
timeout: 0 timeout: 0
# The entry name that will be displayed in the boot menu. # The entry name that will be displayed in the boot menu.
/zenithos /montaukos
# We use the Limine boot protocol. # We use the Limine boot protocol.
protocol: limine protocol: limine
-50109
View File
File diff suppressed because it is too large Load Diff
+12 -3
View File
@@ -9,8 +9,10 @@ ARCH := x86_64
TOOLCHAIN_PREFIX := $(shell cd .. && pwd)/toolchain/local/bin/x86_64-elf- TOOLCHAIN_PREFIX := $(shell cd .. && pwd)/toolchain/local/bin/x86_64-elf-
ifneq ($(wildcard $(TOOLCHAIN_PREFIX)gcc),) ifneq ($(wildcard $(TOOLCHAIN_PREFIX)gcc),)
CXX := $(TOOLCHAIN_PREFIX)g++ CXX := $(TOOLCHAIN_PREFIX)g++
CC := $(TOOLCHAIN_PREFIX)gcc
else else
CXX := g++ CXX := g++
CC := gcc
endif endif
# Compiler flags: freestanding, no stdlib, kernel-mode compatible. # Compiler flags: freestanding, no stdlib, kernel-mode compatible.
@@ -86,9 +88,16 @@ HOMEKEEP := $(BINDIR)/home/.keep
all: bearssl libc libjpeg tls $(TARGETS) fetch wiki wikipedia weather imageviewer fontpreview doom desktop icons fonts $(GAME_DATA) $(MANDST) $(WWWDST) $(CA_CERTS) $(HOMEKEEP) all: bearssl libc libjpeg tls $(TARGETS) fetch wiki wikipedia weather imageviewer fontpreview doom desktop icons fonts $(GAME_DATA) $(MANDST) $(WWWDST) $(CA_CERTS) $(HOMEKEEP)
# Build BearSSL static library. # Build BearSSL static library (cross-compiled for freestanding x86_64).
bearssl: BEARSSL_INCLUDES := -isystem $(shell cd .. && pwd)/kernel/freestnd-c-hdrs/x86_64/include -isystem $(abspath include/libc)
$(MAKE) -C lib/bearssl
lib/bearssl/build/libbearssl.a:
$(MAKE) -C lib/bearssl CONF=MontaukOS \
BEARSSL_CC="$(CC)" \
BEARSSL_AR="$(TOOLCHAIN_PREFIX)ar" \
BEARSSL_INCLUDES="$(BEARSSL_INCLUDES)"
bearssl: lib/bearssl/build/libbearssl.a
# Build shared libc static library. # Build shared libc static library.
libc: libc:
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* Syscall.hpp * Syscall.hpp
* ZenithOS syscall definitions for userspace programs * MontaukOS syscall definitions for userspace programs
* Copyright (c) 2025 Daniel Hammer * Copyright (c) 2025 Daniel Hammer
*/ */
@@ -8,7 +8,7 @@
#include <cstdint> #include <cstdint>
#include <cstddef> #include <cstddef>
namespace Zenith { namespace Montauk {
// Syscall numbers // Syscall numbers
static constexpr uint64_t SYS_EXIT = 0; static constexpr uint64_t SYS_EXIT = 0;
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
* canvas.hpp * canvas.hpp
* ZenithOS Canvas — drawing primitives for pixel buffer (uint32_t*) targets * MontaukOS Canvas — drawing primitives for pixel buffer (uint32_t*) targets
* Mirrors Framebuffer API but operates directly on app content buffers. * Mirrors Framebuffer API but operates directly on app content buffers.
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
+4 -4
View File
@@ -1,6 +1,6 @@
/* /*
* desktop.hpp * desktop.hpp
* ZenithOS desktop state and compositor declarations * MontaukOS desktop state and compositor declarations
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -50,7 +50,7 @@ struct DesktopState {
int window_count; int window_count;
int focused_window; int focused_window;
Zenith::MouseState mouse; Montauk::MouseState mouse;
uint8_t prev_buttons; uint8_t prev_buttons;
bool app_menu_open; bool app_menu_open;
@@ -92,7 +92,7 @@ struct DesktopState {
int ctx_menu_x, ctx_menu_y; int ctx_menu_x, ctx_menu_y;
bool net_popup_open; bool net_popup_open;
Zenith::NetCfg cached_net_cfg; Montauk::NetCfg cached_net_cfg;
uint64_t net_cfg_last_poll; uint64_t net_cfg_last_poll;
Rect net_icon_rect; Rect net_icon_rect;
@@ -111,6 +111,6 @@ void desktop_raise_window(DesktopState* ds, int idx);
void desktop_draw_panel(DesktopState* ds); void desktop_draw_panel(DesktopState* ds);
void desktop_draw_window(DesktopState* ds, int idx); void desktop_draw_window(DesktopState* ds, int idx);
void desktop_handle_mouse(DesktopState* ds); void desktop_handle_mouse(DesktopState* ds);
void desktop_handle_keyboard(DesktopState* ds, const Zenith::KeyEvent& key); void desktop_handle_keyboard(DesktopState* ds, const Montauk::KeyEvent& key);
} // namespace gui } // namespace gui
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
* draw.hpp * draw.hpp
* ZenithOS drawing primitives (lines, circles, rounded rects, cursor) * MontaukOS drawing primitives (lines, circles, rounded rects, cursor)
* Copyright (c) 2025 Daniel Hammer * Copyright (c) 2025 Daniel Hammer
*/ */
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
* font.hpp * font.hpp
* ZenithOS text rendering — TrueType with bitmap fallback * MontaukOS text rendering — TrueType with bitmap fallback
* Copyright (c) 2025 Daniel Hammer * Copyright (c) 2025 Daniel Hammer
*/ */
+6 -6
View File
@@ -1,12 +1,12 @@
/* /*
* framebuffer.hpp * framebuffer.hpp
* ZenithOS double-buffered framebuffer abstraction * MontaukOS double-buffered framebuffer abstraction
* Copyright (c) 2025 Daniel Hammer * Copyright (c) 2025 Daniel Hammer
*/ */
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <zenith/syscall.h> #include <montauk/syscall.h>
#include "gui/gui.hpp" #include "gui/gui.hpp"
namespace gui { namespace gui {
@@ -20,15 +20,15 @@ class Framebuffer {
public: public:
Framebuffer() : hw_fb(nullptr), back_buf(nullptr), fb_width(0), fb_height(0), fb_pitch(0) { Framebuffer() : hw_fb(nullptr), back_buf(nullptr), fb_width(0), fb_height(0), fb_pitch(0) {
Zenith::FbInfo info; Montauk::FbInfo info;
zenith::fb_info(&info); montauk::fb_info(&info);
fb_width = (int)info.width; fb_width = (int)info.width;
fb_height = (int)info.height; fb_height = (int)info.height;
fb_pitch = (int)info.pitch; fb_pitch = (int)info.pitch;
hw_fb = (uint32_t*)zenith::fb_map(); hw_fb = (uint32_t*)montauk::fb_map();
back_buf = (uint32_t*)zenith::alloc((uint64_t)fb_height * fb_pitch); back_buf = (uint32_t*)montauk::alloc((uint64_t)fb_height * fb_pitch);
} }
int width() const { return fb_width; } int width() const { return fb_width; }
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
* gui.hpp * gui.hpp
* ZenithOS core GUI types and utilities * MontaukOS core GUI types and utilities
* Copyright (c) 2025 Daniel Hammer * Copyright (c) 2025 Daniel Hammer
*/ */
+19 -19
View File
@@ -1,6 +1,6 @@
/* /*
* svg.hpp * svg.hpp
* ZenithOS SVG icon parser and scanline rasterizer * MontaukOS SVG icon parser and scanline rasterizer
* Handles the Flat-Remix symbolic icon subset (path, circle, rect) * Handles the Flat-Remix symbolic icon subset (path, circle, rect)
* All math uses 16.16 fixed-point -- NO floating point. * All math uses 16.16 fixed-point -- NO floating point.
* Copyright (c) 2025 Daniel Hammer * Copyright (c) 2025 Daniel Hammer
@@ -8,7 +8,7 @@
#pragma once #pragma once
#include "gui/gui.hpp" #include "gui/gui.hpp"
#include <zenith/syscall.h> #include <montauk/syscall.h>
namespace gui { namespace gui {
@@ -321,7 +321,7 @@ struct SvgEdgeList {
int capacity; int capacity;
void init(int cap) { void init(int cap) {
edges = (SvgEdge*)zenith::alloc(cap * sizeof(SvgEdge)); edges = (SvgEdge*)montauk::alloc(cap * sizeof(SvgEdge));
count = 0; count = 0;
capacity = cap; capacity = cap;
} }
@@ -800,7 +800,7 @@ inline void svg_rasterize(const SvgEdgeList& el, uint32_t* pixels, int w, int h,
// Temporary array for x-intersections on each scanline // Temporary array for x-intersections on each scanline
// Allocate enough for all edges (each edge can intersect at most once per scanline) // Allocate enough for all edges (each edge can intersect at most once per scanline)
int maxIsect = el.count + 16; int maxIsect = el.count + 16;
fixed_t* isect = (fixed_t*)zenith::alloc(maxIsect * sizeof(fixed_t)); fixed_t* isect = (fixed_t*)montauk::alloc(maxIsect * sizeof(fixed_t));
for (int y = 0; y < h; ++y) { for (int y = 0; y < h; ++y) {
// Scanline center in fixed-point // Scanline center in fixed-point
@@ -858,7 +858,7 @@ inline void svg_rasterize(const SvgEdgeList& el, uint32_t* pixels, int w, int h,
} }
} }
zenith::free(isect); montauk::free(isect);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -1018,7 +1018,7 @@ inline void svg_rasterize_blend(const SvgEdgeList& el, uint32_t* pixels, int w,
if (el.count == 0) return; if (el.count == 0) return;
int maxIsect = el.count + 16; int maxIsect = el.count + 16;
fixed_t* isect = (fixed_t*)zenith::alloc(maxIsect * sizeof(fixed_t)); fixed_t* isect = (fixed_t*)montauk::alloc(maxIsect * sizeof(fixed_t));
uint32_t fr = (fill >> 16) & 0xFF; uint32_t fr = (fill >> 16) & 0xFF;
uint32_t fg = (fill >> 8) & 0xFF; uint32_t fg = (fill >> 8) & 0xFF;
@@ -1081,7 +1081,7 @@ inline void svg_rasterize_blend(const SvgEdgeList& el, uint32_t* pixels, int w,
} }
} }
zenith::free(isect); montauk::free(isect);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -1091,7 +1091,7 @@ inline SvgIcon svg_render(const char* svg_data, int svg_len, int target_w, int t
SvgIcon icon; SvgIcon icon;
icon.width = target_w; icon.width = target_w;
icon.height = target_h; icon.height = target_h;
icon.pixels = (uint32_t*)zenith::alloc(target_w * target_h * sizeof(uint32_t)); icon.pixels = (uint32_t*)montauk::alloc(target_w * target_h * sizeof(uint32_t));
// Clear to transparent // Clear to transparent
svg_memset(icon.pixels, 0, target_w * target_h * sizeof(uint32_t)); svg_memset(icon.pixels, 0, target_w * target_h * sizeof(uint32_t));
@@ -1359,7 +1359,7 @@ inline SvgIcon svg_render(const char* svg_data, int svg_len, int target_w, int t
++p; ++p;
} }
zenith::free(el.edges); montauk::free(el.edges);
return icon; return icon;
} }
@@ -1367,20 +1367,20 @@ inline SvgIcon svg_render(const char* svg_data, int svg_len, int target_w, int t
// Load SVG from VFS and render // Load SVG from VFS and render
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
inline SvgIcon svg_load(const char* vfs_path, int target_w, int target_h, Color fill_color) { inline SvgIcon svg_load(const char* vfs_path, int target_w, int target_h, Color fill_color) {
int fd = zenith::open(vfs_path); int fd = montauk::open(vfs_path);
if (fd < 0) { if (fd < 0) {
return {nullptr, 0, 0}; return {nullptr, 0, 0};
} }
uint64_t size = zenith::getsize(fd); uint64_t size = montauk::getsize(fd);
if (size == 0 || size > SVG_MAX_FILE_SIZE) { if (size == 0 || size > SVG_MAX_FILE_SIZE) {
zenith::close(fd); montauk::close(fd);
return {nullptr, 0, 0}; return {nullptr, 0, 0};
} }
char* buf = (char*)zenith::alloc(size + 1); char* buf = (char*)montauk::alloc(size + 1);
zenith::read(fd, (uint8_t*)buf, 0, size); montauk::read(fd, (uint8_t*)buf, 0, size);
zenith::close(fd); montauk::close(fd);
buf[size] = '\0'; buf[size] = '\0';
// 4x supersampling: render at 4x resolution, then downsample with box filter // 4x supersampling: render at 4x resolution, then downsample with box filter
@@ -1389,12 +1389,12 @@ inline SvgIcon svg_load(const char* vfs_path, int target_w, int target_h, Color
int hi_h = target_h * SS; int hi_h = target_h * SS;
SvgIcon hi = svg_render(buf, (int)size, hi_w, hi_h, fill_color); SvgIcon hi = svg_render(buf, (int)size, hi_w, hi_h, fill_color);
zenith::free(buf); montauk::free(buf);
if (!hi.pixels) return {nullptr, 0, 0}; if (!hi.pixels) return {nullptr, 0, 0};
// Allocate final icon at target resolution // Allocate final icon at target resolution
uint32_t* out = (uint32_t*)zenith::alloc(target_w * target_h * 4); uint32_t* out = (uint32_t*)montauk::alloc(target_w * target_h * 4);
for (int i = 0; i < target_w * target_h; i++) out[i] = 0; for (int i = 0; i < target_w * target_h; i++) out[i] = 0;
// Downsample: average each SSxSS block using premultiplied alpha // Downsample: average each SSxSS block using premultiplied alpha
@@ -1432,7 +1432,7 @@ inline SvgIcon svg_load(const char* vfs_path, int target_w, int target_h, Color
} }
} }
zenith::free(hi.pixels); montauk::free(hi.pixels);
return {out, target_w, target_h}; return {out, target_w, target_h};
} }
@@ -1440,7 +1440,7 @@ inline SvgIcon svg_load(const char* vfs_path, int target_w, int target_h, Color
// Free icon pixel data // Free icon pixel data
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
inline void svg_free(SvgIcon& icon) { inline void svg_free(SvgIcon& icon) {
if (icon.pixels) zenith::free(icon.pixels); if (icon.pixels) montauk::free(icon.pixels);
icon.pixels = nullptr; icon.pixels = nullptr;
icon.width = 0; icon.width = 0;
icon.height = 0; icon.height = 0;
+15 -15
View File
@@ -1,14 +1,14 @@
/* /*
* terminal.hpp * terminal.hpp
* ZenithOS terminal emulator with ANSI escape sequence support * MontaukOS terminal emulator with ANSI escape sequence support
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
#pragma once #pragma once
#include "gui/gui.hpp" #include "gui/gui.hpp"
#include "gui/font.hpp" #include "gui/font.hpp"
#include <zenith/syscall.h> #include <montauk/syscall.h>
#include <zenith/string.h> #include <montauk/string.h>
#include <Api/Syscall.hpp> #include <Api/Syscall.hpp>
namespace gui { namespace gui {
@@ -102,8 +102,8 @@ static inline void terminal_init_cells(TerminalState* t, int cols, int rows) {
t->child_pid = 0; t->child_pid = 0;
int total_cells = cols * rows; int total_cells = cols * rows;
t->cells = (TermCell*)zenith::alloc(total_cells * sizeof(TermCell)); t->cells = (TermCell*)montauk::alloc(total_cells * sizeof(TermCell));
t->alt_cells = (TermCell*)zenith::alloc(total_cells * sizeof(TermCell)); t->alt_cells = (TermCell*)montauk::alloc(total_cells * sizeof(TermCell));
for (int i = 0; i < total_cells; i++) { for (int i = 0; i < total_cells; i++) {
t->cells[i] = {' ', colors::TERM_FG, colors::TERM_BG}; t->cells[i] = {' ', colors::TERM_FG, colors::TERM_BG};
t->alt_cells[i] = {' ', colors::TERM_FG, colors::TERM_BG}; t->alt_cells[i] = {' ', colors::TERM_FG, colors::TERM_BG};
@@ -114,8 +114,8 @@ static inline void terminal_init(TerminalState* t, int cols, int rows) {
terminal_init_cells(t, cols, rows); terminal_init_cells(t, cols, rows);
t->cursor_visible = true; t->cursor_visible = true;
t->child_pid = zenith::spawn_redir("0:/os/shell.elf"); t->child_pid = montauk::spawn_redir("0:/os/shell.elf");
zenith::childio_settermsz(t->child_pid, cols, rows); montauk::childio_settermsz(t->child_pid, cols, rows);
} }
static inline void terminal_put_char(TerminalState* t, char ch) { static inline void terminal_put_char(TerminalState* t, char ch) {
@@ -537,8 +537,8 @@ static inline void terminal_resize(TerminalState* t, int new_cols, int new_rows)
if (new_cols < 1 || new_rows < 1) return; if (new_cols < 1 || new_rows < 1) return;
int new_total = new_cols * new_rows; int new_total = new_cols * new_rows;
TermCell* new_cells = (TermCell*)zenith::alloc(new_total * sizeof(TermCell)); TermCell* new_cells = (TermCell*)montauk::alloc(new_total * sizeof(TermCell));
TermCell* new_alt = (TermCell*)zenith::alloc(new_total * sizeof(TermCell)); TermCell* new_alt = (TermCell*)montauk::alloc(new_total * sizeof(TermCell));
// Clear new buffers // Clear new buffers
for (int i = 0; i < new_total; i++) { for (int i = 0; i < new_total; i++) {
@@ -562,8 +562,8 @@ static inline void terminal_resize(TerminalState* t, int new_cols, int new_rows)
} }
} }
if (t->cells) zenith::mfree(t->cells); if (t->cells) montauk::mfree(t->cells);
if (t->alt_cells) zenith::mfree(t->alt_cells); if (t->alt_cells) montauk::mfree(t->alt_cells);
t->cells = new_cells; t->cells = new_cells;
t->alt_cells = new_alt; t->alt_cells = new_alt;
@@ -580,20 +580,20 @@ static inline void terminal_resize(TerminalState* t, int new_cols, int new_rows)
// Notify child process of new terminal size // Notify child process of new terminal size
if (t->child_pid > 0) { if (t->child_pid > 0) {
zenith::childio_settermsz(t->child_pid, new_cols, new_rows); montauk::childio_settermsz(t->child_pid, new_cols, new_rows);
} }
} }
static inline void terminal_handle_key(TerminalState* t, const Zenith::KeyEvent& key) { static inline void terminal_handle_key(TerminalState* t, const Montauk::KeyEvent& key) {
if (t->child_pid > 0) { if (t->child_pid > 0) {
zenith::childio_writekey(t->child_pid, &key); montauk::childio_writekey(t->child_pid, &key);
} }
} }
static inline void terminal_poll(TerminalState* t) { static inline void terminal_poll(TerminalState* t) {
if (t->child_pid <= 0) return; if (t->child_pid <= 0) return;
char buf[512]; char buf[512];
int n = zenith::childio_read(t->child_pid, buf, sizeof(buf)); int n = montauk::childio_read(t->child_pid, buf, sizeof(buf));
if (n > 0) { if (n > 0) {
terminal_feed(t, buf, n); terminal_feed(t, buf, n);
} }
+21 -21
View File
@@ -1,14 +1,14 @@
/* /*
* truetype.hpp * truetype.hpp
* ZenithOS TrueType font rendering via stb_truetype * MontaukOS TrueType font rendering via stb_truetype
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <zenith/syscall.h> #include <montauk/syscall.h>
#include <zenith/heap.h> #include <montauk/heap.h>
#include <zenith/string.h> #include <montauk/string.h>
#include "gui/gui.hpp" #include "gui/gui.hpp"
#include "gui/framebuffer.hpp" #include "gui/framebuffer.hpp"
@@ -29,11 +29,11 @@
#define STBTT_cos(x) stb_cos(x) #define STBTT_cos(x) stb_cos(x)
#define STBTT_acos(x) stb_acos(x) #define STBTT_acos(x) stb_acos(x)
#define STBTT_fabs(x) stb_fabs(x) #define STBTT_fabs(x) stb_fabs(x)
#define STBTT_malloc(x,u) ((void)(u), zenith::malloc(x)) #define STBTT_malloc(x,u) ((void)(u), montauk::malloc(x))
#define STBTT_free(x,u) ((void)(u), zenith::mfree(x)) #define STBTT_free(x,u) ((void)(u), montauk::mfree(x))
#define STBTT_memcpy(d,s,n) zenith::memcpy(d,s,n) #define STBTT_memcpy(d,s,n) montauk::memcpy(d,s,n)
#define STBTT_memset(d,v,n) zenith::memset(d,v,n) #define STBTT_memset(d,v,n) montauk::memset(d,v,n)
#define STBTT_strlen(x) zenith::slen(x) #define STBTT_strlen(x) montauk::slen(x)
#define STBTT_assert(x) ((void)(x)) #define STBTT_assert(x) ((void)(x))
#endif #endif
@@ -69,26 +69,26 @@ struct TrueTypeFont {
data = nullptr; data = nullptr;
cache_count = 0; cache_count = 0;
int fd = zenith::open(vfs_path); int fd = montauk::open(vfs_path);
if (fd < 0) return false; if (fd < 0) return false;
uint64_t size = zenith::getsize(fd); uint64_t size = montauk::getsize(fd);
if (size == 0 || size > 1024 * 1024) { if (size == 0 || size > 1024 * 1024) {
zenith::close(fd); montauk::close(fd);
return false; return false;
} }
data = (uint8_t*)zenith::alloc(size); data = (uint8_t*)montauk::alloc(size);
if (!data) { if (!data) {
zenith::close(fd); montauk::close(fd);
return false; return false;
} }
zenith::read(fd, data, 0, size); montauk::read(fd, data, 0, size);
zenith::close(fd); montauk::close(fd);
if (!stbtt_InitFont(&info, data, stbtt_GetFontOffsetForIndex(data, 0))) { if (!stbtt_InitFont(&info, data, stbtt_GetFontOffsetForIndex(data, 0))) {
zenith::free(data); montauk::free(data);
data = nullptr; data = nullptr;
return false; return false;
} }
@@ -145,7 +145,7 @@ struct TrueTypeFont {
g->yoff = y0; g->yoff = y0;
if (g->width > 0 && g->height > 0) { if (g->width > 0 && g->height > 0) {
g->bitmap = (uint8_t*)zenith::malloc(g->width * g->height); g->bitmap = (uint8_t*)montauk::malloc(g->width * g->height);
stbtt_MakeCodepointBitmap(&info, g->bitmap, g->width, g->height, stbtt_MakeCodepointBitmap(&info, g->bitmap, g->width, g->height,
g->width, gc->scale, gc->scale, codepoint); g->width, gc->scale, gc->scale, codepoint);
} }
@@ -314,10 +314,10 @@ namespace fonts {
inline bool init() { inline bool init() {
auto load = [](const char* path) -> TrueTypeFont* { auto load = [](const char* path) -> TrueTypeFont* {
TrueTypeFont* f = (TrueTypeFont*)zenith::malloc(sizeof(TrueTypeFont)); TrueTypeFont* f = (TrueTypeFont*)montauk::malloc(sizeof(TrueTypeFont));
zenith::memset(f, 0, sizeof(TrueTypeFont)); montauk::memset(f, 0, sizeof(TrueTypeFont));
if (!f->init(path)) { if (!f->init(path)) {
zenith::mfree(f); montauk::mfree(f);
return nullptr; return nullptr;
} }
return f; return f;
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* widgets.hpp * widgets.hpp
* ZenithOS GUI widget toolkit (Label, Button, TextBox, Scrollbar) * MontaukOS GUI widget toolkit (Label, Button, TextBox, Scrollbar)
* Copyright (c) 2025 Daniel Hammer * Copyright (c) 2025 Daniel Hammer
*/ */
@@ -227,7 +227,7 @@ struct TextBox {
} }
} }
void handle_key(const Zenith::KeyEvent& key) { void handle_key(const Montauk::KeyEvent& key) {
if (!focused || !key.pressed) return; if (!focused || !key.pressed) return;
if (key.ascii == '\b' || key.scancode == 0x0E) { if (key.ascii == '\b' || key.scancode == 0x0E) {
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* window.hpp * window.hpp
* ZenithOS window management types * MontaukOS window management types
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -32,7 +32,7 @@ static constexpr int MIN_WINDOW_H = 80;
struct Window; struct Window;
using WindowDrawCallback = void (*)(Window* win, Framebuffer& fb); using WindowDrawCallback = void (*)(Window* win, Framebuffer& fb);
using WindowMouseCallback = void (*)(Window* win, MouseEvent& ev); using WindowMouseCallback = void (*)(Window* win, MouseEvent& ev);
using WindowKeyCallback = void (*)(Window* win, const Zenith::KeyEvent& key); using WindowKeyCallback = void (*)(Window* win, const Montauk::KeyEvent& key);
using WindowCloseCallback = void (*)(Window* win); using WindowCloseCallback = void (*)(Window* win);
using WindowPollCallback = void (*)(Window* win); using WindowPollCallback = void (*)(Window* win);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef _LIBC_SYS_TIME_H #ifndef _LIBC_SYS_TIME_H
#define _LIBC_SYS_TIME_H #define _LIBC_SYS_TIME_H
/* Stub header for ZenithOS */ /* Stub header for MontaukOS */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -1,15 +1,15 @@
/* /*
* heap.h * heap.h
* Userspace heap allocator for ZenithOS programs * Userspace heap allocator for MontaukOS programs
* Free-list allocator backed by SYS_ALLOC page requests. * Free-list allocator backed by SYS_ALLOC page requests.
* Adapted from the kernel HeapAllocator. * Adapted from the kernel HeapAllocator.
* Copyright (c) 2025 Daniel Hammer * Copyright (c) 2025 Daniel Hammer
*/ */
#pragma once #pragma once
#include <zenith/syscall.h> #include <montauk/syscall.h>
namespace zenith { namespace montauk {
namespace heap_detail { namespace heap_detail {
static constexpr uint64_t HEADER_MAGIC = 0x5A484541; // "ZHEA" static constexpr uint64_t HEADER_MAGIC = 0x5A484541; // "ZHEA"
@@ -43,7 +43,7 @@ namespace heap_detail {
uint64_t pages = (bytes + 0xFFF) / 0x1000; uint64_t pages = (bytes + 0xFFF) / 0x1000;
if (pages < 4) pages = 4; // grow at least 16 KiB at a time if (pages < 4) pages = 4; // grow at least 16 KiB at a time
void* mem = zenith::alloc(pages * 0x1000); void* mem = montauk::alloc(pages * 0x1000);
if (mem == nullptr) return false; if (mem == nullptr) return false;
insert_free(mem, pages * 0x1000); insert_free(mem, pages * 0x1000);
return true; return true;
@@ -132,4 +132,4 @@ namespace heap_detail {
return newBlock; return newBlock;
} }
} // namespace zenith } // namespace montauk
@@ -1,13 +1,13 @@
/* /*
* string.h * string.h
* Common string and memory utility functions for ZenithOS programs * Common string and memory utility functions for MontaukOS programs
* Copyright (c) 2025-2026 Daniel Hammer * Copyright (c) 2025-2026 Daniel Hammer
*/ */
#pragma once #pragma once
#include <cstdint> #include <cstdint>
namespace zenith { namespace montauk {
inline int slen(const char* s) { inline int slen(const char* s) {
int n = 0; int n = 0;
@@ -1,13 +1,13 @@
/* /*
* syscall.h * syscall.h
* ZenithOS program-side syscall wrappers using SYSCALL instruction * MontaukOS program-side syscall wrappers using SYSCALL instruction
* Copyright (c) 2025 Daniel Hammer * Copyright (c) 2025 Daniel Hammer
*/ */
#pragma once #pragma once
#include <Api/Syscall.hpp> #include <Api/Syscall.hpp>
namespace zenith { namespace montauk {
// ---- Raw SYSCALL wrappers ---- // ---- Raw SYSCALL wrappers ----
@@ -110,224 +110,224 @@ namespace zenith {
// Process // Process
[[noreturn]] inline void exit(int code = 0) { [[noreturn]] inline void exit(int code = 0) {
syscall1(Zenith::SYS_EXIT, (uint64_t)code); syscall1(Montauk::SYS_EXIT, (uint64_t)code);
__builtin_unreachable(); __builtin_unreachable();
} }
inline void yield() { syscall0(Zenith::SYS_YIELD); } inline void yield() { syscall0(Montauk::SYS_YIELD); }
inline void sleep_ms(uint64_t ms) { syscall1(Zenith::SYS_SLEEP_MS, ms); } inline void sleep_ms(uint64_t ms) { syscall1(Montauk::SYS_SLEEP_MS, ms); }
inline int getpid() { return (int)syscall0(Zenith::SYS_GETPID); } inline int getpid() { return (int)syscall0(Montauk::SYS_GETPID); }
inline int spawn(const char* path, const char* args = nullptr) { inline int spawn(const char* path, const char* args = nullptr) {
return (int)syscall2(Zenith::SYS_SPAWN, (uint64_t)path, (uint64_t)args); return (int)syscall2(Montauk::SYS_SPAWN, (uint64_t)path, (uint64_t)args);
} }
// Console // Console
inline void print(const char* text) { syscall1(Zenith::SYS_PRINT, (uint64_t)text); } inline void print(const char* text) { syscall1(Montauk::SYS_PRINT, (uint64_t)text); }
inline void putchar(char c) { syscall1(Zenith::SYS_PUTCHAR, (uint64_t)c); } inline void putchar(char c) { syscall1(Montauk::SYS_PUTCHAR, (uint64_t)c); }
// File I/O // File I/O
inline int open(const char* path) { return (int)syscall1(Zenith::SYS_OPEN, (uint64_t)path); } inline int open(const char* path) { return (int)syscall1(Montauk::SYS_OPEN, (uint64_t)path); }
inline int read(int handle, uint8_t* buf, uint64_t off, uint64_t size) { inline int read(int handle, uint8_t* buf, uint64_t off, uint64_t size) {
return (int)syscall4(Zenith::SYS_READ, (uint64_t)handle, (uint64_t)buf, off, size); return (int)syscall4(Montauk::SYS_READ, (uint64_t)handle, (uint64_t)buf, off, size);
} }
inline uint64_t getsize(int handle) { return (uint64_t)syscall1(Zenith::SYS_GETSIZE, (uint64_t)handle); } inline uint64_t getsize(int handle) { return (uint64_t)syscall1(Montauk::SYS_GETSIZE, (uint64_t)handle); }
inline void close(int handle) { syscall1(Zenith::SYS_CLOSE, (uint64_t)handle); } inline void close(int handle) { syscall1(Montauk::SYS_CLOSE, (uint64_t)handle); }
inline int readdir(const char* path, const char** names, int max) { inline int readdir(const char* path, const char** names, int max) {
return (int)syscall3(Zenith::SYS_READDIR, (uint64_t)path, (uint64_t)names, (uint64_t)max); return (int)syscall3(Montauk::SYS_READDIR, (uint64_t)path, (uint64_t)names, (uint64_t)max);
} }
// File write/create // File write/create
inline int fwrite(int handle, const uint8_t* buf, uint64_t off, uint64_t size) { inline int fwrite(int handle, const uint8_t* buf, uint64_t off, uint64_t size) {
return (int)syscall4(Zenith::SYS_FWRITE, (uint64_t)handle, (uint64_t)buf, off, size); return (int)syscall4(Montauk::SYS_FWRITE, (uint64_t)handle, (uint64_t)buf, off, size);
} }
inline int fcreate(const char* path) { inline int fcreate(const char* path) {
return (int)syscall1(Zenith::SYS_FCREATE, (uint64_t)path); return (int)syscall1(Montauk::SYS_FCREATE, (uint64_t)path);
} }
// Memory // Memory
inline void* alloc(uint64_t size) { return (void*)syscall1(Zenith::SYS_ALLOC, size); } inline void* alloc(uint64_t size) { return (void*)syscall1(Montauk::SYS_ALLOC, size); }
inline void free(void* ptr) { syscall1(Zenith::SYS_FREE, (uint64_t)ptr); } inline void free(void* ptr) { syscall1(Montauk::SYS_FREE, (uint64_t)ptr); }
// Timekeeping // Timekeeping
inline uint64_t get_ticks() { return (uint64_t)syscall0(Zenith::SYS_GETTICKS); } inline uint64_t get_ticks() { return (uint64_t)syscall0(Montauk::SYS_GETTICKS); }
inline uint64_t get_milliseconds() { return (uint64_t)syscall0(Zenith::SYS_GETMILLISECONDS); } inline uint64_t get_milliseconds() { return (uint64_t)syscall0(Montauk::SYS_GETMILLISECONDS); }
// System // System
inline void get_info(Zenith::SysInfo* info) { syscall1(Zenith::SYS_GETINFO, (uint64_t)info); } inline void get_info(Montauk::SysInfo* info) { syscall1(Montauk::SYS_GETINFO, (uint64_t)info); }
// Keyboard // Keyboard
inline bool is_key_available() { return (bool)syscall0(Zenith::SYS_ISKEYAVAILABLE); } inline bool is_key_available() { return (bool)syscall0(Montauk::SYS_ISKEYAVAILABLE); }
inline void getkey(Zenith::KeyEvent* out) { syscall1(Zenith::SYS_GETKEY, (uint64_t)out); } inline void getkey(Montauk::KeyEvent* out) { syscall1(Montauk::SYS_GETKEY, (uint64_t)out); }
inline char getchar() { return (char)syscall0(Zenith::SYS_GETCHAR); } inline char getchar() { return (char)syscall0(Montauk::SYS_GETCHAR); }
// Networking // Networking
inline int32_t ping(uint32_t ip, uint32_t timeoutMs = 3000) { inline int32_t ping(uint32_t ip, uint32_t timeoutMs = 3000) {
return (int32_t)syscall2(Zenith::SYS_PING, (uint64_t)ip, (uint64_t)timeoutMs); return (int32_t)syscall2(Montauk::SYS_PING, (uint64_t)ip, (uint64_t)timeoutMs);
} }
// DNS resolve: returns IP in network byte order, or 0 on failure // DNS resolve: returns IP in network byte order, or 0 on failure
inline uint32_t resolve(const char* hostname) { inline uint32_t resolve(const char* hostname) {
return (uint32_t)syscall1(Zenith::SYS_RESOLVE, (uint64_t)hostname); return (uint32_t)syscall1(Montauk::SYS_RESOLVE, (uint64_t)hostname);
} }
// Network configuration // Network configuration
inline void get_netcfg(Zenith::NetCfg* out) { syscall1(Zenith::SYS_GETNETCFG, (uint64_t)out); } inline void get_netcfg(Montauk::NetCfg* out) { syscall1(Montauk::SYS_GETNETCFG, (uint64_t)out); }
inline int set_netcfg(const Zenith::NetCfg* cfg) { return (int)syscall1(Zenith::SYS_SETNETCFG, (uint64_t)cfg); } inline int set_netcfg(const Montauk::NetCfg* cfg) { return (int)syscall1(Montauk::SYS_SETNETCFG, (uint64_t)cfg); }
// Sockets // Sockets
inline int socket(int type) { inline int socket(int type) {
return (int)syscall1(Zenith::SYS_SOCKET, (uint64_t)type); return (int)syscall1(Montauk::SYS_SOCKET, (uint64_t)type);
} }
inline int connect(int fd, uint32_t ip, uint16_t port) { inline int connect(int fd, uint32_t ip, uint16_t port) {
return (int)syscall3(Zenith::SYS_CONNECT, (uint64_t)fd, (uint64_t)ip, (uint64_t)port); return (int)syscall3(Montauk::SYS_CONNECT, (uint64_t)fd, (uint64_t)ip, (uint64_t)port);
} }
inline int bind(int fd, uint16_t port) { inline int bind(int fd, uint16_t port) {
return (int)syscall2(Zenith::SYS_BIND, (uint64_t)fd, (uint64_t)port); return (int)syscall2(Montauk::SYS_BIND, (uint64_t)fd, (uint64_t)port);
} }
inline int listen(int fd) { inline int listen(int fd) {
return (int)syscall1(Zenith::SYS_LISTEN, (uint64_t)fd); return (int)syscall1(Montauk::SYS_LISTEN, (uint64_t)fd);
} }
inline int accept(int fd) { inline int accept(int fd) {
return (int)syscall1(Zenith::SYS_ACCEPT, (uint64_t)fd); return (int)syscall1(Montauk::SYS_ACCEPT, (uint64_t)fd);
} }
inline int send(int fd, const void* data, uint32_t len) { inline int send(int fd, const void* data, uint32_t len) {
return (int)syscall3(Zenith::SYS_SEND, (uint64_t)fd, (uint64_t)data, (uint64_t)len); return (int)syscall3(Montauk::SYS_SEND, (uint64_t)fd, (uint64_t)data, (uint64_t)len);
} }
inline int recv(int fd, void* buf, uint32_t maxLen) { inline int recv(int fd, void* buf, uint32_t maxLen) {
return (int)syscall3(Zenith::SYS_RECV, (uint64_t)fd, (uint64_t)buf, (uint64_t)maxLen); return (int)syscall3(Montauk::SYS_RECV, (uint64_t)fd, (uint64_t)buf, (uint64_t)maxLen);
} }
inline int closesocket(int fd) { inline int closesocket(int fd) {
return (int)syscall1(Zenith::SYS_CLOSESOCK, (uint64_t)fd); return (int)syscall1(Montauk::SYS_CLOSESOCK, (uint64_t)fd);
} }
inline int sendto(int fd, const void* data, uint32_t len, uint32_t destIp, uint16_t destPort) { inline int sendto(int fd, const void* data, uint32_t len, uint32_t destIp, uint16_t destPort) {
return (int)syscall5(Zenith::SYS_SENDTO, (uint64_t)fd, (uint64_t)data, return (int)syscall5(Montauk::SYS_SENDTO, (uint64_t)fd, (uint64_t)data,
(uint64_t)len, (uint64_t)destIp, (uint64_t)destPort); (uint64_t)len, (uint64_t)destIp, (uint64_t)destPort);
} }
inline int recvfrom(int fd, void* buf, uint32_t maxLen, uint32_t* srcIp, uint16_t* srcPort) { inline int recvfrom(int fd, void* buf, uint32_t maxLen, uint32_t* srcIp, uint16_t* srcPort) {
return (int)syscall5(Zenith::SYS_RECVFROM, (uint64_t)fd, (uint64_t)buf, return (int)syscall5(Montauk::SYS_RECVFROM, (uint64_t)fd, (uint64_t)buf,
(uint64_t)maxLen, (uint64_t)srcIp, (uint64_t)srcPort); (uint64_t)maxLen, (uint64_t)srcIp, (uint64_t)srcPort);
} }
// Process management // Process management
inline void waitpid(int pid) { syscall1(Zenith::SYS_WAITPID, (uint64_t)pid); } inline void waitpid(int pid) { syscall1(Montauk::SYS_WAITPID, (uint64_t)pid); }
// Framebuffer // Framebuffer
inline void fb_info(Zenith::FbInfo* info) { syscall1(Zenith::SYS_FBINFO, (uint64_t)info); } inline void fb_info(Montauk::FbInfo* info) { syscall1(Montauk::SYS_FBINFO, (uint64_t)info); }
inline void* fb_map() { return (void*)syscall0(Zenith::SYS_FBMAP); } inline void* fb_map() { return (void*)syscall0(Montauk::SYS_FBMAP); }
// Arguments // Arguments
inline int getargs(char* buf, uint64_t maxLen) { inline int getargs(char* buf, uint64_t maxLen) {
return (int)syscall2(Zenith::SYS_GETARGS, (uint64_t)buf, maxLen); return (int)syscall2(Montauk::SYS_GETARGS, (uint64_t)buf, maxLen);
} }
// Terminal // Terminal
inline void termsize(int* cols, int* rows) { inline void termsize(int* cols, int* rows) {
uint64_t r = (uint64_t)syscall0(Zenith::SYS_TERMSIZE); uint64_t r = (uint64_t)syscall0(Montauk::SYS_TERMSIZE);
if (cols) *cols = (int)(r & 0xFFFFFFFF); if (cols) *cols = (int)(r & 0xFFFFFFFF);
if (rows) *rows = (int)(r >> 32); if (rows) *rows = (int)(r >> 32);
} }
inline void termscale(int scale_x, int scale_y) { inline void termscale(int scale_x, int scale_y) {
syscall2(Zenith::SYS_TERMSCALE, (uint64_t)scale_x, (uint64_t)scale_y); syscall2(Montauk::SYS_TERMSCALE, (uint64_t)scale_x, (uint64_t)scale_y);
} }
inline void get_termscale(int* scale_x, int* scale_y) { inline void get_termscale(int* scale_x, int* scale_y) {
uint64_t r = (uint64_t)syscall2(Zenith::SYS_TERMSCALE, 0, 0); uint64_t r = (uint64_t)syscall2(Montauk::SYS_TERMSCALE, 0, 0);
if (scale_x) *scale_x = (int)(r & 0xFFFFFFFF); if (scale_x) *scale_x = (int)(r & 0xFFFFFFFF);
if (scale_y) *scale_y = (int)(r >> 32); if (scale_y) *scale_y = (int)(r >> 32);
} }
// Timekeeping (wall-clock) // Timekeeping (wall-clock)
inline void gettime(Zenith::DateTime* out) { syscall1(Zenith::SYS_GETTIME, (uint64_t)out); } inline void gettime(Montauk::DateTime* out) { syscall1(Montauk::SYS_GETTIME, (uint64_t)out); }
// Random number generation // Random number generation
inline int64_t getrandom(void* buf, uint32_t len) { inline int64_t getrandom(void* buf, uint32_t len) {
return syscall2(Zenith::SYS_GETRANDOM, (uint64_t)buf, (uint64_t)len); return syscall2(Montauk::SYS_GETRANDOM, (uint64_t)buf, (uint64_t)len);
} }
// Power management // Power management
[[noreturn]] inline void reset() { [[noreturn]] inline void reset() {
syscall0(Zenith::SYS_RESET); syscall0(Montauk::SYS_RESET);
__builtin_unreachable(); __builtin_unreachable();
} }
[[noreturn]] inline void shutdown() { [[noreturn]] inline void shutdown() {
syscall0(Zenith::SYS_SHUTDOWN); syscall0(Montauk::SYS_SHUTDOWN);
__builtin_unreachable(); __builtin_unreachable();
} }
// Mouse // Mouse
inline void mouse_state(Zenith::MouseState* out) { syscall1(Zenith::SYS_MOUSESTATE, (uint64_t)out); } inline void mouse_state(Montauk::MouseState* out) { syscall1(Montauk::SYS_MOUSESTATE, (uint64_t)out); }
inline void set_mouse_bounds(int32_t maxX, int32_t maxY) { inline void set_mouse_bounds(int32_t maxX, int32_t maxY) {
syscall2(Zenith::SYS_SETMOUSEBOUNDS, (uint64_t)maxX, (uint64_t)maxY); syscall2(Montauk::SYS_SETMOUSEBOUNDS, (uint64_t)maxX, (uint64_t)maxY);
} }
// Kernel log // Kernel log
inline int64_t read_klog(char* buf, uint64_t size) { inline int64_t read_klog(char* buf, uint64_t size) {
return syscall2(Zenith::SYS_KLOG, (uint64_t)buf, size); return syscall2(Montauk::SYS_KLOG, (uint64_t)buf, size);
} }
// I/O redirection // I/O redirection
inline int spawn_redir(const char* path, const char* args = nullptr) { inline int spawn_redir(const char* path, const char* args = nullptr) {
return (int)syscall2(Zenith::SYS_SPAWN_REDIR, (uint64_t)path, (uint64_t)args); return (int)syscall2(Montauk::SYS_SPAWN_REDIR, (uint64_t)path, (uint64_t)args);
} }
inline int childio_read(int childPid, char* buf, int maxLen) { inline int childio_read(int childPid, char* buf, int maxLen) {
return (int)syscall3(Zenith::SYS_CHILDIO_READ, (uint64_t)childPid, (uint64_t)buf, (uint64_t)maxLen); return (int)syscall3(Montauk::SYS_CHILDIO_READ, (uint64_t)childPid, (uint64_t)buf, (uint64_t)maxLen);
} }
inline int childio_write(int childPid, const char* data, int len) { inline int childio_write(int childPid, const char* data, int len) {
return (int)syscall3(Zenith::SYS_CHILDIO_WRITE, (uint64_t)childPid, (uint64_t)data, (uint64_t)len); return (int)syscall3(Montauk::SYS_CHILDIO_WRITE, (uint64_t)childPid, (uint64_t)data, (uint64_t)len);
} }
inline int childio_writekey(int childPid, const Zenith::KeyEvent* key) { inline int childio_writekey(int childPid, const Montauk::KeyEvent* key) {
return (int)syscall2(Zenith::SYS_CHILDIO_WRITEKEY, (uint64_t)childPid, (uint64_t)key); return (int)syscall2(Montauk::SYS_CHILDIO_WRITEKEY, (uint64_t)childPid, (uint64_t)key);
} }
inline int childio_settermsz(int childPid, int cols, int rows) { inline int childio_settermsz(int childPid, int cols, int rows) {
return (int)syscall3(Zenith::SYS_CHILDIO_SETTERMSZ, (uint64_t)childPid, (uint64_t)cols, (uint64_t)rows); return (int)syscall3(Montauk::SYS_CHILDIO_SETTERMSZ, (uint64_t)childPid, (uint64_t)cols, (uint64_t)rows);
} }
// Process listing / kill // Process listing / kill
inline int proclist(Zenith::ProcInfo* buf, int max) { inline int proclist(Montauk::ProcInfo* buf, int max) {
return (int)syscall2(Zenith::SYS_PROCLIST, (uint64_t)buf, (uint64_t)max); return (int)syscall2(Montauk::SYS_PROCLIST, (uint64_t)buf, (uint64_t)max);
} }
inline int kill(int pid) { inline int kill(int pid) {
return (int)syscall1(Zenith::SYS_KILL, (uint64_t)pid); return (int)syscall1(Montauk::SYS_KILL, (uint64_t)pid);
} }
inline int devlist(Zenith::DevInfo* buf, int max) { inline int devlist(Montauk::DevInfo* buf, int max) {
return (int)syscall2(Zenith::SYS_DEVLIST, (uint64_t)buf, (uint64_t)max); return (int)syscall2(Montauk::SYS_DEVLIST, (uint64_t)buf, (uint64_t)max);
} }
// Kernel introspection // Kernel introspection
inline void memstats(Zenith::MemStats* out) { syscall1(Zenith::SYS_MEMSTATS, (uint64_t)out); } inline void memstats(Montauk::MemStats* out) { syscall1(Montauk::SYS_MEMSTATS, (uint64_t)out); }
// Window server // Window server
inline int win_create(const char* title, int w, int h, Zenith::WinCreateResult* result) { inline int win_create(const char* title, int w, int h, Montauk::WinCreateResult* result) {
return (int)syscall4(Zenith::SYS_WINCREATE, (uint64_t)title, (uint64_t)w, (uint64_t)h, (uint64_t)result); return (int)syscall4(Montauk::SYS_WINCREATE, (uint64_t)title, (uint64_t)w, (uint64_t)h, (uint64_t)result);
} }
inline int win_destroy(int id) { inline int win_destroy(int id) {
return (int)syscall1(Zenith::SYS_WINDESTROY, (uint64_t)id); return (int)syscall1(Montauk::SYS_WINDESTROY, (uint64_t)id);
} }
inline uint64_t win_present(int id) { inline uint64_t win_present(int id) {
return (uint64_t)syscall1(Zenith::SYS_WINPRESENT, (uint64_t)id); return (uint64_t)syscall1(Montauk::SYS_WINPRESENT, (uint64_t)id);
} }
inline int win_poll(int id, Zenith::WinEvent* event) { inline int win_poll(int id, Montauk::WinEvent* event) {
return (int)syscall2(Zenith::SYS_WINPOLL, (uint64_t)id, (uint64_t)event); return (int)syscall2(Montauk::SYS_WINPOLL, (uint64_t)id, (uint64_t)event);
} }
inline int win_enumerate(Zenith::WinInfo* info, int max) { inline int win_enumerate(Montauk::WinInfo* info, int max) {
return (int)syscall2(Zenith::SYS_WINENUM, (uint64_t)info, (uint64_t)max); return (int)syscall2(Montauk::SYS_WINENUM, (uint64_t)info, (uint64_t)max);
} }
inline uint64_t win_map(int id) { inline uint64_t win_map(int id) {
return (uint64_t)syscall1(Zenith::SYS_WINMAP, (uint64_t)id); return (uint64_t)syscall1(Montauk::SYS_WINMAP, (uint64_t)id);
} }
inline int win_sendevent(int id, const Zenith::WinEvent* event) { inline int win_sendevent(int id, const Montauk::WinEvent* event) {
return (int)syscall2(Zenith::SYS_WINSENDEVENT, (uint64_t)id, (uint64_t)event); return (int)syscall2(Montauk::SYS_WINSENDEVENT, (uint64_t)id, (uint64_t)event);
} }
inline uint64_t win_resize(int id, int w, int h) { inline uint64_t win_resize(int id, int w, int h) {
return (uint64_t)syscall3(Zenith::SYS_WINRESIZE, (uint64_t)id, (uint64_t)w, (uint64_t)h); return (uint64_t)syscall3(Montauk::SYS_WINRESIZE, (uint64_t)id, (uint64_t)w, (uint64_t)h);
} }
inline int win_setscale(int scale) { inline int win_setscale(int scale) {
return (int)syscall1(Zenith::SYS_WINSETSCALE, (uint64_t)scale); return (int)syscall1(Montauk::SYS_WINSETSCALE, (uint64_t)scale);
} }
inline int win_getscale() { inline int win_getscale() {
return (int)syscall0(Zenith::SYS_WINGETSCALE); return (int)syscall0(Montauk::SYS_WINGETSCALE);
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
* tls.hpp * tls.hpp
* Shared TLS helper library for ZenithOS * Shared TLS helper library for MontaukOS
* Trust anchor loading, BearSSL time, TLS I/O, HTTPS fetch * Trust anchor loading, BearSSL time, TLS I/O, HTTPS fetch
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
+1 -1
View File
@@ -1,4 +1,4 @@
# Makefile for shared libc static library on ZenithOS # Makefile for shared libc static library on MontaukOS
# Copyright (c) 2025-2026 Daniel Hammer # Copyright (c) 2025-2026 Daniel Hammer
MAKEFLAGS += -rR MAKEFLAGS += -rR
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
* libc.c * libc.c
* Minimal C standard library for ZenithOS userspace programs * Minimal C standard library for MontaukOS userspace programs
* Based on the proven libc from the DOOM port. * Based on the proven libc from the DOOM port.
* Copyright (c) 2025-2026 Daniel Hammer * Copyright (c) 2025-2026 Daniel Hammer
*/ */
Binary file not shown.
+1 -1
View File
@@ -1,4 +1,4 @@
# Makefile for libjpeg (JPEG decoding via stb_image) on ZenithOS # Makefile for libjpeg (JPEG decoding via stb_image) on MontaukOS
# Copyright (c) 2026 Daniel Hammer # Copyright (c) 2026 Daniel Hammer
MAKEFLAGS += -rR MAKEFLAGS += -rR
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* stb_image_impl.c * stb_image_impl.c
* Single compilation unit for stb_image JPEG decoder on ZenithOS * Single compilation unit for stb_image JPEG decoder on MontaukOS
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -21,7 +21,7 @@
#define STBI_NO_STDIO #define STBI_NO_STDIO
#define STBI_NO_THREAD_LOCALS #define STBI_NO_THREAD_LOCALS
/* Route allocations through libc (which uses ZenithOS heap). */ /* Route allocations through libc (which uses MontaukOS heap). */
#define STBI_MALLOC(sz) malloc(sz) #define STBI_MALLOC(sz) malloc(sz)
#define STBI_FREE(p) free(p) #define STBI_FREE(p) free(p)
#define STBI_REALLOC(p, newsz) realloc(p, newsz) #define STBI_REALLOC(p, newsz) realloc(p, newsz)
+1 -1
View File
@@ -1,4 +1,4 @@
# Makefile for shared TLS helper library on ZenithOS # Makefile for shared TLS helper library on MontaukOS
# Copyright (c) 2026 Daniel Hammer # Copyright (c) 2026 Daniel Hammer
MAKEFLAGS += -rR MAKEFLAGS += -rR
Binary file not shown.
Binary file not shown.
+31 -31
View File
@@ -1,12 +1,12 @@
/* /*
* tls.cpp * tls.cpp
* Shared TLS helper library for ZenithOS * Shared TLS helper library for MontaukOS
* Extracted from fetch, wiki, wikipedia, and weather apps * Extracted from fetch, wiki, wikipedia, and weather apps
* Copyright (c) 2025-2026 Daniel Hammer * Copyright (c) 2025-2026 Daniel Hammer
*/ */
#include <tls/tls.hpp> #include <tls/tls.hpp>
#include <zenith/syscall.h> #include <montauk/syscall.h>
extern "C" { extern "C" {
#include <string.h> #include <string.h>
@@ -109,15 +109,15 @@ namespace tls {
TrustAnchors load_trust_anchors() { TrustAnchors load_trust_anchors() {
TrustAnchors tas = {nullptr, 0, 0}; TrustAnchors tas = {nullptr, 0, 0};
int fh = zenith::open("0:/etc/ca-certificates.crt"); int fh = montauk::open("0:/etc/ca-certificates.crt");
if (fh < 0) return tas; if (fh < 0) return tas;
uint64_t fsize = zenith::getsize(fh); uint64_t fsize = montauk::getsize(fh);
if (fsize == 0 || fsize > 512 * 1024) { zenith::close(fh); return tas; } if (fsize == 0 || fsize > 512 * 1024) { montauk::close(fh); return tas; }
unsigned char* pem = (unsigned char*)malloc(fsize + 1); unsigned char* pem = (unsigned char*)malloc(fsize + 1);
if (!pem) { zenith::close(fh); return tas; } if (!pem) { montauk::close(fh); return tas; }
zenith::read(fh, pem, 0, fsize); montauk::read(fh, pem, 0, fsize);
zenith::close(fh); montauk::close(fh);
pem[fsize] = 0; pem[fsize] = 0;
static br_pem_decoder_context pc; // keep off stack static br_pem_decoder_context pc; // keep off stack
@@ -147,8 +147,8 @@ TrustAnchors load_trust_anchors() {
} }
void get_bearssl_time(uint32_t* days, uint32_t* seconds) { void get_bearssl_time(uint32_t* days, uint32_t* seconds) {
Zenith::DateTime dt; Montauk::DateTime dt;
zenith::gettime(&dt); montauk::gettime(&dt);
int y = dt.Year, m = dt.Month, d = dt.Day; int y = dt.Year, m = dt.Month, d = dt.Day;
uint32_t total = 365u * (uint32_t)y uint32_t total = 365u * (uint32_t)y
+ (uint32_t)(y/4) - (uint32_t)(y/100) + (uint32_t)(y/400); + (uint32_t)(y/4) - (uint32_t)(y/100) + (uint32_t)(y/400);
@@ -162,24 +162,24 @@ void get_bearssl_time(uint32_t* days, uint32_t* seconds) {
int tls_send_all(int fd, const unsigned char* data, size_t len) { int tls_send_all(int fd, const unsigned char* data, size_t len) {
size_t sent = 0; size_t sent = 0;
uint64_t deadline = zenith::get_milliseconds() + 15000; uint64_t deadline = montauk::get_milliseconds() + 15000;
while (sent < len) { while (sent < len) {
int r = zenith::send(fd, data + sent, (uint32_t)(len - sent)); int r = montauk::send(fd, data + sent, (uint32_t)(len - sent));
if (r > 0) { sent += r; deadline = zenith::get_milliseconds() + 15000; } if (r > 0) { sent += r; deadline = montauk::get_milliseconds() + 15000; }
else if (r < 0) return -1; else if (r < 0) return -1;
else { if (zenith::get_milliseconds() >= deadline) return -1; zenith::sleep_ms(1); } else { if (montauk::get_milliseconds() >= deadline) return -1; montauk::sleep_ms(1); }
} }
return (int)sent; return (int)sent;
} }
int tls_recv_some(int fd, unsigned char* buf, size_t maxlen) { int tls_recv_some(int fd, unsigned char* buf, size_t maxlen) {
uint64_t deadline = zenith::get_milliseconds() + 15000; uint64_t deadline = montauk::get_milliseconds() + 15000;
while (true) { while (true) {
int r = zenith::recv(fd, buf, (uint32_t)maxlen); int r = montauk::recv(fd, buf, (uint32_t)maxlen);
if (r > 0) return r; if (r > 0) return r;
if (r < 0) return -1; if (r < 0) return -1;
if (zenith::get_milliseconds() >= deadline) return -1; if (montauk::get_milliseconds() >= deadline) return -1;
zenith::sleep_ms(1); montauk::sleep_ms(1);
} }
} }
@@ -189,7 +189,7 @@ int tls_exchange(int fd, br_ssl_engine_context* eng,
AbortCheckFn abort_check) { AbortCheckFn abort_check) {
bool requestSent = false; bool requestSent = false;
int respLen = 0; int respLen = 0;
uint64_t deadline = zenith::get_milliseconds() + 30000; uint64_t deadline = montauk::get_milliseconds() + 30000;
while (true) { while (true) {
unsigned state = br_ssl_engine_current_state(eng); unsigned state = br_ssl_engine_current_state(eng);
@@ -207,7 +207,7 @@ int tls_exchange(int fd, br_ssl_engine_context* eng,
int sent = tls_send_all(fd, buf, len); int sent = tls_send_all(fd, buf, len);
if (sent < 0) { br_ssl_engine_close(eng); return respLen > 0 ? respLen : -1; } if (sent < 0) { br_ssl_engine_close(eng); return respLen > 0 ? respLen : -1; }
br_ssl_engine_sendrec_ack(eng, len); br_ssl_engine_sendrec_ack(eng, len);
deadline = zenith::get_milliseconds() + 30000; continue; deadline = montauk::get_milliseconds() + 30000; continue;
} }
if (state & BR_SSL_RECVAPP) { if (state & BR_SSL_RECVAPP) {
size_t len; unsigned char* buf = br_ssl_engine_recvapp_buf(eng, &len); size_t len; unsigned char* buf = br_ssl_engine_recvapp_buf(eng, &len);
@@ -215,7 +215,7 @@ int tls_exchange(int fd, br_ssl_engine_context* eng,
if (respLen + (int)toCopy > respMax - 1) toCopy = respMax - 1 - respLen; if (respLen + (int)toCopy > respMax - 1) toCopy = respMax - 1 - respLen;
if (toCopy > 0) { memcpy(respBuf + respLen, buf, toCopy); respLen += toCopy; } if (toCopy > 0) { memcpy(respBuf + respLen, buf, toCopy); respLen += toCopy; }
br_ssl_engine_recvapp_ack(eng, len); br_ssl_engine_recvapp_ack(eng, len);
deadline = zenith::get_milliseconds() + 30000; continue; deadline = montauk::get_milliseconds() + 30000; continue;
} }
if ((state & BR_SSL_SENDAPP) && !requestSent) { if ((state & BR_SSL_SENDAPP) && !requestSent) {
size_t len; unsigned char* buf = br_ssl_engine_sendapp_buf(eng, &len); size_t len; unsigned char* buf = br_ssl_engine_sendapp_buf(eng, &len);
@@ -225,17 +225,17 @@ int tls_exchange(int fd, br_ssl_engine_context* eng,
br_ssl_engine_sendapp_ack(eng, toWrite); br_ssl_engine_sendapp_ack(eng, toWrite);
br_ssl_engine_flush(eng, 0); br_ssl_engine_flush(eng, 0);
requestSent = true; requestSent = true;
deadline = zenith::get_milliseconds() + 30000; continue; deadline = montauk::get_milliseconds() + 30000; continue;
} }
if (state & BR_SSL_RECVREC) { if (state & BR_SSL_RECVREC) {
size_t len; unsigned char* buf = br_ssl_engine_recvrec_buf(eng, &len); size_t len; unsigned char* buf = br_ssl_engine_recvrec_buf(eng, &len);
int got = tls_recv_some(fd, buf, len); int got = tls_recv_some(fd, buf, len);
if (got < 0) { br_ssl_engine_close(eng); return respLen > 0 ? respLen : -1; } if (got < 0) { br_ssl_engine_close(eng); return respLen > 0 ? respLen : -1; }
br_ssl_engine_recvrec_ack(eng, got); br_ssl_engine_recvrec_ack(eng, got);
deadline = zenith::get_milliseconds() + 30000; continue; deadline = montauk::get_milliseconds() + 30000; continue;
} }
if (zenith::get_milliseconds() >= deadline) return respLen > 0 ? respLen : -1; if (montauk::get_milliseconds() >= deadline) return respLen > 0 ? respLen : -1;
zenith::sleep_ms(1); montauk::sleep_ms(1);
} }
} }
@@ -244,16 +244,16 @@ int https_fetch(const char* host, uint32_t ip, uint16_t port,
const TrustAnchors& tas, const TrustAnchors& tas,
char* respBuf, int respMax, char* respBuf, int respMax,
AbortCheckFn abort_check) { AbortCheckFn abort_check) {
int fd = zenith::socket(Zenith::SOCK_TCP); int fd = montauk::socket(Montauk::SOCK_TCP);
if (fd < 0) return -1; if (fd < 0) return -1;
if (zenith::connect(fd, ip, port) < 0) { zenith::closesocket(fd); return -1; } if (montauk::connect(fd, ip, port) < 0) { montauk::closesocket(fd); return -1; }
br_ssl_client_context* cc = (br_ssl_client_context*)malloc(sizeof(*cc)); br_ssl_client_context* cc = (br_ssl_client_context*)malloc(sizeof(*cc));
br_x509_minimal_context* xc = (br_x509_minimal_context*)malloc(sizeof(*xc)); br_x509_minimal_context* xc = (br_x509_minimal_context*)malloc(sizeof(*xc));
void* iobuf = malloc(BR_SSL_BUFSIZE_BIDI); void* iobuf = malloc(BR_SSL_BUFSIZE_BIDI);
if (!cc || !xc || !iobuf) { if (!cc || !xc || !iobuf) {
free(cc); free(xc); free(iobuf); free(cc); free(xc); free(iobuf);
zenith::closesocket(fd); return -1; montauk::closesocket(fd); return -1;
} }
br_ssl_client_init_full(cc, xc, tas.anchors, tas.count); br_ssl_client_init_full(cc, xc, tas.anchors, tas.count);
@@ -262,16 +262,16 @@ int https_fetch(const char* host, uint32_t ip, uint16_t port,
br_x509_minimal_set_time(xc, days, secs); br_x509_minimal_set_time(xc, days, secs);
unsigned char seed[32]; unsigned char seed[32];
zenith::getrandom(seed, sizeof(seed)); montauk::getrandom(seed, sizeof(seed));
br_ssl_engine_set_buffer(&cc->eng, iobuf, BR_SSL_BUFSIZE_BIDI, 1); br_ssl_engine_set_buffer(&cc->eng, iobuf, BR_SSL_BUFSIZE_BIDI, 1);
br_ssl_engine_inject_entropy(&cc->eng, seed, sizeof(seed)); br_ssl_engine_inject_entropy(&cc->eng, seed, sizeof(seed));
if (!br_ssl_client_reset(cc, host, 0)) { if (!br_ssl_client_reset(cc, host, 0)) {
zenith::closesocket(fd); free(cc); free(xc); free(iobuf); return -1; montauk::closesocket(fd); free(cc); free(xc); free(iobuf); return -1;
} }
int respLen = tls_exchange(fd, &cc->eng, request, reqLen, respBuf, respMax, abort_check); int respLen = tls_exchange(fd, &cc->eng, request, reqLen, respBuf, respMax, abort_check);
zenith::closesocket(fd); montauk::closesocket(fd);
free(cc); free(xc); free(iobuf); free(cc); free(xc); free(iobuf);
return respLen; return respLen;
} }
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
* link.ld * link.ld
* Linker script for ZenithOS userspace programs * Linker script for MontaukOS userspace programs
* Copyright (c) 2025 Daniel Hammer * Copyright (c) 2025 Daniel Hammer
* *
* Programs are loaded at a standard user-space address. * Programs are loaded at a standard user-space address.
+1 -1
View File
@@ -1,6 +1,6 @@
.TH EDIT 1 .TH EDIT 1
.SH NAME .SH NAME
edit - text editor for ZenithOS edit - text editor for MontaukOS
.SH SYNOPSIS .SH SYNOPSIS
edit [filename] edit [filename]
+1 -1
View File
@@ -1,6 +1,6 @@
.TH FETCH 1 .TH FETCH 1
.SH NAME .SH NAME
fetch - HTTP/HTTPS client for ZenithOS fetch - HTTP/HTTPS client for MontaukOS
.SH SYNOPSIS .SH SYNOPSIS
fetch [-v] <url> fetch [-v] <url>
+18 -18
View File
@@ -3,14 +3,14 @@
open, read, getsize, close, readdir - file I/O system calls open, read, getsize, close, readdir - file I/O system calls
.SH SYNOPSIS .SH SYNOPSIS
.BI int zenith::open(const char* path); .BI int montauk::open(const char* path);
.BI int zenith::read(int handle, uint8_t* buf, uint64_t offset, uint64_t size); .BI int montauk::read(int handle, uint8_t* buf, uint64_t offset, uint64_t size);
.BI uint64_t zenith::getsize(int handle); .BI uint64_t montauk::getsize(int handle);
.BI void zenith::close(int handle); .BI void montauk::close(int handle);
.BI int zenith::readdir(const char* path, const char** names, int max); .BI int montauk::readdir(const char* path, const char** names, int max);
.SH DESCRIPTION .SH DESCRIPTION
ZenithOS provides a simple read-only Virtual File System (VFS) MontaukOS provides a simple read-only Virtual File System (VFS)
backed by the boot ramdisk. Files are accessed via paths in the backed by the boot ramdisk. Files are accessed via paths in the
format "<drive>:/<path>", where drive 0 is the ramdisk. format "<drive>:/<path>", where drive 0 is the ramdisk.
@@ -18,7 +18,7 @@
Opens a file and returns a non-negative handle on success, or a Opens a file and returns a non-negative handle on success, or a
negative value on error (file not found, no free handles). negative value on error (file not found, no free handles).
int h = zenith::open("0:/os/hello.elf"); int h = montauk::open("0:/os/hello.elf");
.SS read .SS read
Reads up to 'size' bytes starting at 'offset' into 'buf'. Reads up to 'size' bytes starting at 'offset' into 'buf'.
@@ -27,17 +27,17 @@
every call. every call.
uint8_t buf[512]; uint8_t buf[512];
int n = zenith::read(h, buf, 0, 512); int n = montauk::read(h, buf, 0, 512);
.SS getsize .SS getsize
Returns the total size in bytes of the file. Returns the total size in bytes of the file.
uint64_t sz = zenith::getsize(h); uint64_t sz = montauk::getsize(h);
.SS close .SS close
Closes the file handle and frees kernel resources. Closes the file handle and frees kernel resources.
zenith::close(h); montauk::close(h);
.SS readdir .SS readdir
Lists entries in a directory. Up to 'max' entry names (max 64) Lists entries in a directory. Up to 'max' entry names (max 64)
@@ -46,32 +46,32 @@
entries are returned with a trailing slash. entries are returned with a trailing slash.
const char* entries[64]; const char* entries[64];
int count = zenith::readdir("0:/", entries, 64); int count = montauk::readdir("0:/", entries, 64);
// entries: "os/", "games/", "man/", "www/", "home/" // entries: "os/", "games/", "man/", "www/", "home/"
.SH READING PATTERN .SH READING PATTERN
The standard pattern for reading a file: The standard pattern for reading a file:
int h = zenith::open("0:/man/intro.1"); int h = montauk::open("0:/man/intro.1");
uint64_t size = zenith::getsize(h); uint64_t size = montauk::getsize(h);
uint8_t buf[512]; uint8_t buf[512];
uint64_t off = 0; uint64_t off = 0;
while (off < size) { while (off < size) {
uint64_t chunk = size - off; uint64_t chunk = size - off;
if (chunk > 511) chunk = 511; if (chunk > 511) chunk = 511;
int n = zenith::read(h, buf, off, chunk); int n = montauk::read(h, buf, off, chunk);
if (n <= 0) break; if (n <= 0) break;
buf[n] = '\0'; buf[n] = '\0';
zenith::print((const char*)buf); montauk::print((const char*)buf);
off += n; off += n;
} }
zenith::close(h); montauk::close(h);
.SH WRITING FILES .SH WRITING FILES
Files can be created and written on the ramdisk: Files can be created and written on the ramdisk:
.BI int zenith::fcreate(const char* path); .BI int montauk::fcreate(const char* path);
.BI int zenith::fwrite(int handle, const uint8_t* buf, uint64_t offset, uint64_t size); .BI int montauk::fwrite(int handle, const uint8_t* buf, uint64_t offset, uint64_t size);
fcreate creates a new file and returns a handle. fwrite writes fcreate creates a new file and returns a handle. fwrite writes
bytes at the given offset. Changes persist only until reboot -- bytes at the given offset. Changes persist only until reboot --
+8 -8
View File
@@ -3,8 +3,8 @@
fb_info, fb_map - direct framebuffer access fb_info, fb_map - direct framebuffer access
.SH SYNOPSIS .SH SYNOPSIS
.BI void zenith::fb_info(Zenith::FbInfo* info); .BI void montauk::fb_info(Montauk::FbInfo* info);
.BI void* zenith::fb_map(); .BI void* montauk::fb_map();
.SH DESCRIPTION .SH DESCRIPTION
These syscalls allow userspace programs to access the linear These syscalls allow userspace programs to access the linear
@@ -13,8 +13,8 @@
.SS fb_info .SS fb_info
Fills in an FbInfo structure with the framebuffer geometry: Fills in an FbInfo structure with the framebuffer geometry:
Zenith::FbInfo fb; Montauk::FbInfo fb;
zenith::fb_info(&fb); montauk::fb_info(&fb);
// fb.width, fb.height, fb.pitch, fb.bpp // fb.width, fb.height, fb.pitch, fb.bpp
The pitch is the number of bytes per scanline (may be larger The pitch is the number of bytes per scanline (may be larger
@@ -24,7 +24,7 @@
Maps the physical framebuffer into the process address space at Maps the physical framebuffer into the process address space at
a fixed virtual address (0x50000000) and returns that address. a fixed virtual address (0x50000000) and returns that address.
uint32_t* pixels = (uint32_t*)zenith::fb_map(); uint32_t* pixels = (uint32_t*)montauk::fb_map();
Each pixel is a 32-bit value in 0xAARRGGBB format (blue in the Each pixel is a 32-bit value in 0xAARRGGBB format (blue in the
low byte). Writing to this memory directly updates the screen. low byte). Writing to this memory directly updates the screen.
@@ -40,9 +40,9 @@
.SH EXAMPLE .SH EXAMPLE
Fill the screen with blue: Fill the screen with blue:
Zenith::FbInfo fb; Montauk::FbInfo fb;
zenith::fb_info(&fb); montauk::fb_info(&fb);
uint32_t* pixels = (uint32_t*)zenith::fb_map(); uint32_t* pixels = (uint32_t*)montauk::fb_map();
for (uint64_t y = 0; y < fb.height; y++) { for (uint64_t y = 0; y < fb.height; y++) {
uint32_t* row = (uint32_t*)((uint8_t*)pixels + y * fb.pitch); uint32_t* row = (uint32_t*)((uint8_t*)pixels + y * fb.pitch);
+2 -2
View File
@@ -1,12 +1,12 @@
.TH INIT 1 .TH INIT 1
.SH NAME .SH NAME
init - ZenithOS init system init - MontaukOS init system
.SH SYNOPSIS .SH SYNOPSIS
Spawned automatically by the kernel as PID 0. Spawned automatically by the kernel as PID 0.
.SH DESCRIPTION .SH DESCRIPTION
init is the first userspace process started by the ZenithOS init is the first userspace process started by the MontaukOS
kernel. It chains system services in sequence, then launches kernel. It chains system services in sequence, then launches
the interactive shell. the interactive shell.
+6 -6
View File
@@ -1,9 +1,9 @@
.TH INTRO 1 .TH INTRO 1
.SH NAME .SH NAME
intro - introduction to ZenithOS userspace intro - introduction to MontaukOS userspace
.SH DESCRIPTION .SH DESCRIPTION
ZenithOS is a hobbyist 64-bit operating system written in C++20. MontaukOS is a hobbyist 64-bit operating system written in C++20.
Userspace programs run in Ring 3, are loaded as static ELF64 Userspace programs run in Ring 3, are loaded as static ELF64
binaries, and communicate with the kernel through the x86-64 binaries, and communicate with the kernel through the x86-64
SYSCALL/SYSRET mechanism. SYSCALL/SYSRET mechanism.
@@ -11,7 +11,7 @@
Programs are compiled with a freestanding cross-compiler and Programs are compiled with a freestanding cross-compiler and
linked at virtual address 0x400000. There is no standard C linked at virtual address 0x400000. There is no standard C
library for C++ programs -- all system interaction goes through library for C++ programs -- all system interaction goes through
the zenith:: syscall wrappers. the montauk:: syscall wrappers.
.SH GETTING STARTED .SH GETTING STARTED
To write a new program, create a directory under programs/src/ To write a new program, create a directory under programs/src/
@@ -19,8 +19,8 @@
extern "C" void _start() { ... } extern "C" void _start() { ... }
There is no argc/argv. Use zenith::getargs() to retrieve any There is no argc/argv. Use montauk::getargs() to retrieve any
arguments passed by the parent process. Include <zenith/syscall.h> arguments passed by the parent process. Include <montauk/syscall.h>
for the full typed syscall API. for the full typed syscall API.
Build with: Build with:
@@ -41,7 +41,7 @@
.SH SHELL .SH SHELL
The interactive shell is the primary way to interact with The interactive shell is the primary way to interact with
ZenithOS. Commands are resolved by searching the PATH MontaukOS. Commands are resolved by searching the PATH
directories (0:/os/, 0:/games/) for matching .elf binaries. directories (0:/os/, 0:/games/) for matching .elf binaries.
Type 'help' at the shell prompt for a list of commands. Type 'help' at the shell prompt for a list of commands.
Use 'man shell' for detailed shell documentation. Use 'man shell' for detailed shell documentation.
+1 -1
View File
@@ -1,6 +1,6 @@
.TH LEGAL 7 .TH LEGAL 7
.SH NAME .SH NAME
ZenithOS legal/copyright information MontaukOS legal/copyright information
.SH DESCRIPTION .SH DESCRIPTION
Copyright (c) 2025-2026 Daniel Hammer, et al. All rights reserved. Copyright (c) 2025-2026 Daniel Hammer, et al. All rights reserved.
+9 -9
View File
@@ -3,14 +3,14 @@
malloc, mfree, realloc - userspace heap allocation malloc, mfree, realloc - userspace heap allocation
.SH SYNOPSIS .SH SYNOPSIS
.BI void* zenith::malloc(uint64_t size); .BI void* montauk::malloc(uint64_t size);
.BI void zenith::mfree(void* ptr); .BI void montauk::mfree(void* ptr);
.BI void* zenith::realloc(void* ptr, uint64_t size); .BI void* montauk::realloc(void* ptr, uint64_t size);
.SH DESCRIPTION .SH DESCRIPTION
The userspace heap provides dynamic memory allocation on top of The userspace heap provides dynamic memory allocation on top of
the kernel's page-mapping syscall (SYS_ALLOC). Include the the kernel's page-mapping syscall (SYS_ALLOC). Include the
header <zenith/heap.h> to use these functions. header <montauk/heap.h> to use these functions.
.SS malloc .SS malloc
Allocates 'size' bytes from the free list. Returns a 16-byte Allocates 'size' bytes from the free list. Returns a 16-byte
@@ -18,21 +18,21 @@
empty, it requests more pages from the kernel via SYS_ALLOC empty, it requests more pages from the kernel via SYS_ALLOC
(minimum 16 KiB growth, initial seed of 64 KiB). (minimum 16 KiB growth, initial seed of 64 KiB).
char* buf = (char*)zenith::malloc(1024); char* buf = (char*)montauk::malloc(1024);
.SS mfree .SS mfree
Returns the block to the userspace free list. No syscall is Returns the block to the userspace free list. No syscall is
made -- the memory stays mapped and is immediately reusable. made -- the memory stays mapped and is immediately reusable.
Passing nullptr is a safe no-op. Passing nullptr is a safe no-op.
zenith::mfree(buf); montauk::mfree(buf);
.SS realloc .SS realloc
Resizes the allocation to 'size' bytes. Allocates a new block, Resizes the allocation to 'size' bytes. Allocates a new block,
copies the smaller of old/new sizes, and frees the old block. copies the smaller of old/new sizes, and frees the old block.
If ptr is nullptr, behaves like malloc. If ptr is nullptr, behaves like malloc.
buf = (char*)zenith::realloc(buf, 2048); buf = (char*)montauk::realloc(buf, 2048);
.SH IMPLEMENTATION .SH IMPLEMENTATION
The allocator uses a linked free-list with first-fit search. The allocator uses a linked free-list with first-fit search.
@@ -47,8 +47,8 @@
.SH LOW-LEVEL PAGE API .SH LOW-LEVEL PAGE API
For large allocations or when direct page control is needed: For large allocations or when direct page control is needed:
void* zenith::alloc(uint64_t size); // SYS_ALLOC void* montauk::alloc(uint64_t size); // SYS_ALLOC
void zenith::free(void* ptr); // SYS_FREE (no-op) void montauk::free(void* ptr); // SYS_FREE (no-op)
alloc() maps zeroed pages starting at 0x40000000 and growing alloc() maps zeroed pages starting at 0x40000000 and growing
upward. Size is rounded up to 4 KiB page boundaries. upward. Size is rounded up to 4 KiB page boundaries.
+2 -2
View File
@@ -1,9 +1,9 @@
.TH SHELL 1 .TH SHELL 1
.SH NAME .SH NAME
shell - ZenithOS interactive command shell shell - MontaukOS interactive command shell
.SH DESCRIPTION .SH DESCRIPTION
The ZenithOS shell is a command interpreter launched by init The MontaukOS shell is a command interpreter launched by init
after system services have started. It provides command after system services have started. It provides command
execution, file navigation, and command history. execution, file navigation, and command history.
+11 -11
View File
@@ -3,9 +3,9 @@
spawn, waitpid - create and wait for processes spawn, waitpid - create and wait for processes
.SH SYNOPSIS .SH SYNOPSIS
.BI int zenith::spawn(const char* path, const char* args = nullptr); .BI int montauk::spawn(const char* path, const char* args = nullptr);
.BI void zenith::waitpid(int pid); .BI void montauk::waitpid(int pid);
.BI int zenith::getargs(char* buf, uint64_t maxLen); .BI int montauk::getargs(char* buf, uint64_t maxLen);
.SH DESCRIPTION .SH DESCRIPTION
@@ -13,11 +13,11 @@
Loads the ELF64 binary at the given VFS path and creates a new Loads the ELF64 binary at the given VFS path and creates a new
process. The path must include the drive prefix, for example: process. The path must include the drive prefix, for example:
int pid = zenith::spawn("0:/os/hello.elf"); int pid = montauk::spawn("0:/os/hello.elf");
An optional second argument passes a string to the child: An optional second argument passes a string to the child:
int pid = zenith::spawn("0:/os/man.elf", "intro"); int pid = montauk::spawn("0:/os/man.elf", "intro");
The new process gets its own PML4 page table, a 16 KiB stack The new process gets its own PML4 page table, a 16 KiB stack
(at 0x7FFFFEF000-0x7FFFFFF000), and begins executing at the (at 0x7FFFFEF000-0x7FFFFFF000), and begins executing at the
@@ -31,7 +31,7 @@
Blocks the calling process until the process with the given PID Blocks the calling process until the process with the given PID
has exited. Internally, this yields the CPU in a loop: has exited. Internally, this yields the CPU in a loop:
zenith::waitpid(pid); montauk::waitpid(pid);
This is how the shell implements foreground process execution -- This is how the shell implements foreground process execution --
it spawns a child and waits for it to complete before showing it spawns a child and waits for it to complete before showing
@@ -40,12 +40,12 @@
.SH EXAMPLES .SH EXAMPLES
Spawn a program and wait for it: Spawn a program and wait for it:
int pid = zenith::spawn("0:/os/hello.elf"); int pid = montauk::spawn("0:/os/hello.elf");
if (pid < 0) { if (pid < 0) {
zenith::print("spawn failed\n"); montauk::print("spawn failed\n");
} else { } else {
zenith::waitpid(pid); montauk::waitpid(pid);
zenith::print("child exited\n"); montauk::print("child exited\n");
} }
.SS getargs .SS getargs
@@ -54,7 +54,7 @@
-1 on error. -1 on error.
char args[256]; char args[256];
zenith::getargs(args, sizeof(args)); montauk::getargs(args, sizeof(args));
The argument string is set by the parent when calling spawn(). The argument string is set by the parent when calling spawn().
If no arguments were provided, the buffer will be empty. If no arguments were provided, the buffer will be empty.
+51 -51
View File
@@ -1,9 +1,9 @@
.TH SYSCALLS 2 .TH SYSCALLS 2
.SH NAME .SH NAME
syscalls - overview of ZenithOS system calls syscalls - overview of MontaukOS system calls
.SH DESCRIPTION .SH DESCRIPTION
ZenithOS provides 46 system calls (numbers 0-45) for userspace MontaukOS provides 46 system calls (numbers 0-45) for userspace
programs. Syscalls use the x86-64 SYSCALL instruction with the programs. Syscalls use the x86-64 SYSCALL instruction with the
following register convention: following register convention:
@@ -15,119 +15,119 @@
R8 Argument 5 R8 Argument 5
R9 Argument 6 R9 Argument 6
Include <zenith/syscall.h> for typed wrappers in the zenith:: Include <montauk/syscall.h> for typed wrappers in the montauk::
namespace. namespace.
.SH PROCESS MANAGEMENT .SH PROCESS MANAGEMENT
.B SYS_EXIT (0) .B SYS_EXIT (0)
Terminate the calling process. Terminate the calling process.
void zenith::exit(int code = 0); void montauk::exit(int code = 0);
.B SYS_YIELD (1) .B SYS_YIELD (1)
Yield the remainder of the time slice. Yield the remainder of the time slice.
void zenith::yield(); void montauk::yield();
.B SYS_SLEEP_MS (2) .B SYS_SLEEP_MS (2)
Sleep for at least the given number of milliseconds. Sleep for at least the given number of milliseconds.
void zenith::sleep_ms(uint64_t ms); void montauk::sleep_ms(uint64_t ms);
.B SYS_GETPID (3) .B SYS_GETPID (3)
Return the PID of the calling process. Return the PID of the calling process.
int zenith::getpid(); int montauk::getpid();
.B SYS_SPAWN (20) .B SYS_SPAWN (20)
Spawn a new process from an ELF binary on the VFS. Spawn a new process from an ELF binary on the VFS.
int zenith::spawn(const char* path, const char* args = nullptr); int montauk::spawn(const char* path, const char* args = nullptr);
.B SYS_WAITPID (23) .B SYS_WAITPID (23)
Block until the given process has exited. Block until the given process has exited.
void zenith::waitpid(int pid); void montauk::waitpid(int pid);
.SH CONSOLE I/O .SH CONSOLE I/O
.B SYS_PRINT (4) .B SYS_PRINT (4)
Write a null-terminated string to the terminal. Write a null-terminated string to the terminal.
void zenith::print(const char* text); void montauk::print(const char* text);
.B SYS_PUTCHAR (5) .B SYS_PUTCHAR (5)
Write a single character to the terminal. Write a single character to the terminal.
void zenith::putchar(char c); void montauk::putchar(char c);
.SH FILE I/O .SH FILE I/O
.B SYS_OPEN (6) .B SYS_OPEN (6)
Open a file. Returns a handle or negative on error. Open a file. Returns a handle or negative on error.
int zenith::open(const char* path); int montauk::open(const char* path);
.B SYS_READ (7) .B SYS_READ (7)
Read bytes from a file at a given offset. Read bytes from a file at a given offset.
int zenith::read(int h, uint8_t* buf, uint64_t off, uint64_t sz); int montauk::read(int h, uint8_t* buf, uint64_t off, uint64_t sz);
.B SYS_GETSIZE (8) .B SYS_GETSIZE (8)
Get the size of an open file in bytes. Get the size of an open file in bytes.
uint64_t zenith::getsize(int handle); uint64_t montauk::getsize(int handle);
.B SYS_CLOSE (9) .B SYS_CLOSE (9)
Close a file handle. Close a file handle.
void zenith::close(int handle); void montauk::close(int handle);
.B SYS_READDIR (10) .B SYS_READDIR (10)
List directory entries (max 64 per call). List directory entries (max 64 per call).
int zenith::readdir(const char* path, const char** names, int max); int montauk::readdir(const char* path, const char** names, int max);
.SH MEMORY .SH MEMORY
.B SYS_ALLOC (11) .B SYS_ALLOC (11)
Map zeroed pages into the process address space. Map zeroed pages into the process address space.
void* zenith::alloc(uint64_t size); void* montauk::alloc(uint64_t size);
.B SYS_FREE (12) .B SYS_FREE (12)
Reserved (currently a no-op). Reserved (currently a no-op).
void zenith::free(void* ptr); void montauk::free(void* ptr);
.SH TIMEKEEPING .SH TIMEKEEPING
.B SYS_GETTICKS (13) .B SYS_GETTICKS (13)
Get APIC timer ticks since boot. Get APIC timer ticks since boot.
uint64_t zenith::get_ticks(); uint64_t montauk::get_ticks();
.B SYS_GETMILLISECONDS (14) .B SYS_GETMILLISECONDS (14)
Get milliseconds elapsed since boot. Get milliseconds elapsed since boot.
uint64_t zenith::get_milliseconds(); uint64_t montauk::get_milliseconds();
.B SYS_GETTIME (28) .B SYS_GETTIME (28)
Get the current wall-clock date and time (UTC). Get the current wall-clock date and time (UTC).
Fills a Zenith::DateTime struct with Year, Month, Day, Fills a Montauk::DateTime struct with Year, Month, Day,
Hour, Minute, and Second fields. Hour, Minute, and Second fields.
void zenith::gettime(Zenith::DateTime* out); void montauk::gettime(Montauk::DateTime* out);
.SH SYSTEM .SH SYSTEM
.B SYS_GETINFO (15) .B SYS_GETINFO (15)
Get OS name, version, and configuration. Get OS name, version, and configuration.
void zenith::get_info(Zenith::SysInfo* info); void montauk::get_info(Montauk::SysInfo* info);
.SH KEYBOARD .SH KEYBOARD
.B SYS_ISKEYAVAILABLE (16) .B SYS_ISKEYAVAILABLE (16)
Check if a key event is pending (non-blocking). Check if a key event is pending (non-blocking).
bool zenith::is_key_available(); bool montauk::is_key_available();
.B SYS_GETKEY (17) .B SYS_GETKEY (17)
Get the next key event (press or release). Get the next key event (press or release).
void zenith::getkey(Zenith::KeyEvent* out); void montauk::getkey(Montauk::KeyEvent* out);
.B SYS_GETCHAR (18) .B SYS_GETCHAR (18)
Block until a printable character is typed. Block until a printable character is typed.
char zenith::getchar(); char montauk::getchar();
.SH NETWORKING .SH NETWORKING
.B SYS_PING (19) .B SYS_PING (19)
Send an ICMP echo request and wait for reply. Send an ICMP echo request and wait for reply.
int32_t zenith::ping(uint32_t ip, uint32_t timeoutMs); int32_t montauk::ping(uint32_t ip, uint32_t timeoutMs);
.B SYS_GETNETCFG (37) .B SYS_GETNETCFG (37)
Get the current network configuration (IP, mask, gateway, MAC, Get the current network configuration (IP, mask, gateway, MAC,
DNS server). DNS server).
void zenith::get_netcfg(Zenith::NetCfg* out); void montauk::get_netcfg(Montauk::NetCfg* out);
.B SYS_SETNETCFG (38) .B SYS_SETNETCFG (38)
Set the network configuration (IP, mask, gateway, DNS server). Set the network configuration (IP, mask, gateway, DNS server).
int zenith::set_netcfg(const Zenith::NetCfg* cfg); int montauk::set_netcfg(const Montauk::NetCfg* cfg);
.B SYS_RESOLVE (44) .B SYS_RESOLVE (44)
Resolve a hostname to an IPv4 address via DNS. Sends a UDP Resolve a hostname to an IPv4 address via DNS. Sends a UDP
@@ -135,106 +135,106 @@
for a reply. Returns the IP in network byte order, or 0 on for a reply. Returns the IP in network byte order, or 0 on
failure. IP address strings (e.g. "10.0.0.1") are detected failure. IP address strings (e.g. "10.0.0.1") are detected
and returned directly without a DNS query. and returned directly without a DNS query.
uint32_t zenith::resolve(const char* hostname); uint32_t montauk::resolve(const char* hostname);
.SH SOCKETS .SH SOCKETS
.B SYS_SOCKET (29) .B SYS_SOCKET (29)
Create a socket. type=SOCK_TCP (1) or SOCK_UDP (2). Create a socket. type=SOCK_TCP (1) or SOCK_UDP (2).
Returns fd or -1. Returns fd or -1.
int zenith::socket(int type); int montauk::socket(int type);
.B SYS_CONNECT (30) .B SYS_CONNECT (30)
Connect a TCP socket to a remote host. Connect a TCP socket to a remote host.
int zenith::connect(int fd, uint32_t ip, uint16_t port); int montauk::connect(int fd, uint32_t ip, uint16_t port);
.B SYS_BIND (31) .B SYS_BIND (31)
Bind a socket to a local port for listening. Bind a socket to a local port for listening.
int zenith::bind(int fd, uint16_t port); int montauk::bind(int fd, uint16_t port);
.B SYS_LISTEN (32) .B SYS_LISTEN (32)
Start listening for incoming TCP connections. Start listening for incoming TCP connections.
int zenith::listen(int fd); int montauk::listen(int fd);
.B SYS_ACCEPT (33) .B SYS_ACCEPT (33)
Accept an incoming connection on a listening socket. Accept an incoming connection on a listening socket.
Returns a new socket fd for the client connection. Returns a new socket fd for the client connection.
int zenith::accept(int fd); int montauk::accept(int fd);
.B SYS_SEND (34) .B SYS_SEND (34)
Send data on a connected socket. Returns bytes sent. Send data on a connected socket. Returns bytes sent.
int zenith::send(int fd, const void* data, uint32_t len); int montauk::send(int fd, const void* data, uint32_t len);
.B SYS_RECV (35) .B SYS_RECV (35)
Receive data from a connected socket. Returns bytes Receive data from a connected socket. Returns bytes
received, 0 if no data available, or -1 on close/error. received, 0 if no data available, or -1 on close/error.
int zenith::recv(int fd, void* buf, uint32_t maxLen); int montauk::recv(int fd, void* buf, uint32_t maxLen);
.B SYS_CLOSESOCK (36) .B SYS_CLOSESOCK (36)
Close a socket and release its resources. Close a socket and release its resources.
int zenith::closesocket(int fd); int montauk::closesocket(int fd);
.B SYS_SENDTO (39) .B SYS_SENDTO (39)
Send a UDP datagram to a specific destination. Send a UDP datagram to a specific destination.
int zenith::sendto(int fd, const void* data, uint32_t len, int montauk::sendto(int fd, const void* data, uint32_t len,
uint32_t destIp, uint16_t destPort); uint32_t destIp, uint16_t destPort);
.B SYS_RECVFROM (40) .B SYS_RECVFROM (40)
Receive a UDP datagram. Returns the source address. Receive a UDP datagram. Returns the source address.
int zenith::recvfrom(int fd, void* buf, uint32_t maxLen, int montauk::recvfrom(int fd, void* buf, uint32_t maxLen,
uint32_t* srcIp, uint16_t* srcPort); uint32_t* srcIp, uint16_t* srcPort);
.SH FILE WRITE .SH FILE WRITE
.B SYS_FWRITE (41) .B SYS_FWRITE (41)
Write bytes to a file at a given offset. Write bytes to a file at a given offset.
int zenith::fwrite(int handle, const uint8_t* buf, int montauk::fwrite(int handle, const uint8_t* buf,
uint64_t offset, uint64_t size); uint64_t offset, uint64_t size);
.B SYS_FCREATE (42) .B SYS_FCREATE (42)
Create a new file on the ramdisk. Returns a handle or negative Create a new file on the ramdisk. Returns a handle or negative
on error. on error.
int zenith::fcreate(const char* path); int montauk::fcreate(const char* path);
.SH FRAMEBUFFER .SH FRAMEBUFFER
.B SYS_FBINFO (21) .B SYS_FBINFO (21)
Get framebuffer dimensions and format. Get framebuffer dimensions and format.
void zenith::fb_info(Zenith::FbInfo* info); void montauk::fb_info(Montauk::FbInfo* info);
.B SYS_FBMAP (22) .B SYS_FBMAP (22)
Map the framebuffer into process memory at 0x50000000. Map the framebuffer into process memory at 0x50000000.
void* zenith::fb_map(); void* montauk::fb_map();
.SH TERMINAL .SH TERMINAL
.B SYS_TERMSIZE (24) .B SYS_TERMSIZE (24)
Get terminal dimensions (columns and rows). Get terminal dimensions (columns and rows).
void zenith::termsize(int* cols, int* rows); void montauk::termsize(int* cols, int* rows);
.B SYS_TERMSCALE (43) .B SYS_TERMSCALE (43)
Get or set the terminal font scale factor. When scale_x is 0, Get or set the terminal font scale factor. When scale_x is 0,
returns the current scale as (scale_y << 32 | scale_x). When returns the current scale as (scale_y << 32 | scale_x). When
scale_x is non-zero, sets the font scale and returns the new scale_x is non-zero, sets the font scale and returns the new
terminal dimensions as (rows << 32 | cols). terminal dimensions as (rows << 32 | cols).
void zenith::termscale(int scale_x, int scale_y); void montauk::termscale(int scale_x, int scale_y);
void zenith::get_termscale(int* scale_x, int* scale_y); void montauk::get_termscale(int* scale_x, int* scale_y);
.SH ARGUMENTS .SH ARGUMENTS
.B SYS_GETARGS (25) .B SYS_GETARGS (25)
Get the argument string passed to this process at spawn time. Get the argument string passed to this process at spawn time.
int zenith::getargs(char* buf, uint64_t maxLen); int montauk::getargs(char* buf, uint64_t maxLen);
.SH RANDOM .SH RANDOM
.B SYS_GETRANDOM (45) .B SYS_GETRANDOM (45)
Fill a buffer with random bytes using RDTSC-seeded entropy. Fill a buffer with random bytes using RDTSC-seeded entropy.
Returns the number of bytes written. Returns the number of bytes written.
int64_t zenith::getrandom(void* buf, uint32_t len); int64_t montauk::getrandom(void* buf, uint32_t len);
.SH POWER MANAGEMENT .SH POWER MANAGEMENT
.B SYS_RESET (26) .B SYS_RESET (26)
Reboot the system. Reboot the system.
[[noreturn]] void zenith::reset(); [[noreturn]] void montauk::reset();
.B SYS_SHUTDOWN (27) .B SYS_SHUTDOWN (27)
Shut down the system (currently unimplemented). Shut down the system (currently unimplemented).
[[noreturn]] void zenith::shutdown(); [[noreturn]] void montauk::shutdown();
.SH SEE ALSO .SH SEE ALSO
spawn(2), file(2), framebuffer(2), malloc(3) spawn(2), file(2), framebuffer(2), malloc(3)
+1 -1
View File
@@ -3,7 +3,7 @@
tls-errors - BearSSL TLS and X.509 error codes tls-errors - BearSSL TLS and X.509 error codes
.SH DESCRIPTION .SH DESCRIPTION
ZenithOS uses BearSSL for TLS 1.2 connections. When a TLS MontaukOS uses BearSSL for TLS 1.2 connections. When a TLS
operation fails, an integer error code is reported. This page operation fails, an integer error code is reported. This page
lists all possible error codes. lists all possible error codes.
+1 -1
View File
@@ -1,6 +1,6 @@
.TH WIKI 1 .TH WIKI 1
.SH NAME .SH NAME
wiki - Wikipedia article viewer for ZenithOS wiki - Wikipedia article viewer for MontaukOS
.SH SYNOPSIS .SH SYNOPSIS
wiki <title> wiki <title>
+17 -17
View File
@@ -4,15 +4,15 @@
* Copyright (c) 2025-2026 Daniel Hammer * Copyright (c) 2025-2026 Daniel Hammer
*/ */
#include <zenith/syscall.h> #include <montauk/syscall.h>
extern "C" void _start() { extern "C" void _start() {
char args[256]; char args[256];
int len = zenith::getargs(args, sizeof(args)); int len = montauk::getargs(args, sizeof(args));
if (len <= 0 || args[0] == '\0') { if (len <= 0 || args[0] == '\0') {
zenith::print("Usage: cat <filename>\n"); montauk::print("Usage: cat <filename>\n");
zenith::exit(1); montauk::exit(1);
} }
// Build VFS path. If the path already starts with "<digit>:", use as-is. // Build VFS path. If the path already starts with "<digit>:", use as-is.
@@ -34,18 +34,18 @@ extern "C" void _start() {
} }
path[i] = '\0'; path[i] = '\0';
int handle = zenith::open(path); int handle = montauk::open(path);
if (handle < 0) { if (handle < 0) {
zenith::print("cat: cannot open '"); montauk::print("cat: cannot open '");
zenith::print(args); montauk::print(args);
zenith::print("'\n"); montauk::print("'\n");
zenith::exit(1); montauk::exit(1);
} }
uint64_t size = zenith::getsize(handle); uint64_t size = montauk::getsize(handle);
if (size == 0) { if (size == 0) {
zenith::close(handle); montauk::close(handle);
zenith::exit(0); montauk::exit(0);
} }
uint8_t buf[512]; uint8_t buf[512];
@@ -53,14 +53,14 @@ extern "C" void _start() {
while (offset < size) { while (offset < size) {
uint64_t chunk = size - offset; uint64_t chunk = size - offset;
if (chunk > sizeof(buf) - 1) chunk = sizeof(buf) - 1; if (chunk > sizeof(buf) - 1) chunk = sizeof(buf) - 1;
int bytesRead = zenith::read(handle, buf, offset, chunk); int bytesRead = montauk::read(handle, buf, offset, chunk);
if (bytesRead <= 0) break; if (bytesRead <= 0) break;
buf[bytesRead] = '\0'; buf[bytesRead] = '\0';
zenith::print((const char*)buf); montauk::print((const char*)buf);
offset += bytesRead; offset += bytesRead;
} }
zenith::close(handle); montauk::close(handle);
zenith::putchar('\n'); montauk::putchar('\n');
zenith::exit(0); montauk::exit(0);
} }
+4 -4
View File
@@ -4,10 +4,10 @@
* Copyright (c) 2025-2026 Daniel Hammer * Copyright (c) 2025-2026 Daniel Hammer
*/ */
#include <zenith/syscall.h> #include <montauk/syscall.h>
extern "C" void _start() { extern "C" void _start() {
zenith::print("\033[2J"); // Clear entire screen montauk::print("\033[2J"); // Clear entire screen
zenith::print("\033[H"); // Move cursor to top-left montauk::print("\033[H"); // Move cursor to top-left
zenith::exit(0); montauk::exit(0);
} }
+14 -14
View File
@@ -4,11 +4,11 @@
* Copyright (c) 2025-2026 Daniel Hammer * Copyright (c) 2025-2026 Daniel Hammer
*/ */
#include <zenith/syscall.h> #include <montauk/syscall.h>
static void print_int(uint64_t n) { static void print_int(uint64_t n) {
if (n == 0) { if (n == 0) {
zenith::putchar('0'); montauk::putchar('0');
return; return;
} }
char buf[20]; char buf[20];
@@ -18,12 +18,12 @@ static void print_int(uint64_t n) {
n /= 10; n /= 10;
} }
for (int j = i - 1; j >= 0; j--) { for (int j = i - 1; j >= 0; j--) {
zenith::putchar(buf[j]); montauk::putchar(buf[j]);
} }
} }
static void print_int_padded(uint64_t n) { static void print_int_padded(uint64_t n) {
if (n < 10) zenith::putchar('0'); if (n < 10) montauk::putchar('0');
print_int(n); print_int(n);
} }
@@ -37,20 +37,20 @@ static const char* month_name(int m) {
} }
extern "C" void _start() { extern "C" void _start() {
Zenith::DateTime dt; Montauk::DateTime dt;
zenith::gettime(&dt); montauk::gettime(&dt);
print_int(dt.Day); print_int(dt.Day);
zenith::putchar(' '); montauk::putchar(' ');
zenith::print(month_name(dt.Month)); montauk::print(month_name(dt.Month));
zenith::putchar(' '); montauk::putchar(' ');
print_int(dt.Year); print_int(dt.Year);
zenith::print(", "); montauk::print(", ");
print_int(dt.Hour); print_int(dt.Hour);
zenith::putchar(':'); montauk::putchar(':');
print_int_padded(dt.Minute); print_int_padded(dt.Minute);
zenith::putchar(':'); montauk::putchar(':');
print_int_padded(dt.Second); print_int_padded(dt.Second);
zenith::print(" UTC\n"); montauk::print(" UTC\n");
zenith::exit(0); montauk::exit(0);
} }
+1 -1
View File
@@ -1,4 +1,4 @@
# Makefile for desktop (GUI desktop environment) on ZenithOS # Makefile for desktop (GUI desktop environment) on MontaukOS
# Copyright (c) 2025 Daniel Hammer # Copyright (c) 2025 Daniel Hammer
MAKEFLAGS += -rR MAKEFLAGS += -rR
+7 -7
View File
@@ -1,6 +1,6 @@
/* /*
* app_calculator.cpp * app_calculator.cpp
* ZenithOS Desktop - Calculator application * MontaukOS Desktop - Calculator application
* Integer-only 4-function calculator (values scaled by 100 for 2 decimal places) * Integer-only 4-function calculator (values scaled by 100 for 2 decimal places)
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -61,7 +61,7 @@ static void calc_format_display(CalcState* cs) {
// Trim trailing zeros after decimal point (unless user is entering decimals) // Trim trailing zeros after decimal point (unless user is entering decimals)
if (!cs->has_decimal) { if (!cs->has_decimal) {
int len = zenith::slen(cs->display_str); int len = montauk::slen(cs->display_str);
while (len > 1 && cs->display_str[len - 1] == '0') { while (len > 1 && cs->display_str[len - 1] == '0') {
cs->display_str[--len] = '\0'; cs->display_str[--len] = '\0';
} }
@@ -237,7 +237,7 @@ static void calculator_on_draw(Window* win, Framebuffer& fb) {
text_w = fonts::system_font->measure_text(cs->display_str, fonts::LARGE_SIZE); text_w = fonts::system_font->measure_text(cs->display_str, fonts::LARGE_SIZE);
large_h = fonts::system_font->get_line_height(fonts::LARGE_SIZE); large_h = fonts::system_font->get_line_height(fonts::LARGE_SIZE);
} else { } else {
int text_len = zenith::slen(cs->display_str); int text_len = montauk::slen(cs->display_str);
text_w = text_len * FONT_WIDTH * 2; text_w = text_len * FONT_WIDTH * 2;
large_h = FONT_HEIGHT * 2; large_h = FONT_HEIGHT * 2;
} }
@@ -342,7 +342,7 @@ static void calculator_on_mouse(Window* win, MouseEvent& ev) {
// Keyboard handling // Keyboard handling
// ============================================================================ // ============================================================================
static void calculator_on_key(Window* win, const Zenith::KeyEvent& key) { static void calculator_on_key(Window* win, const Montauk::KeyEvent& key) {
CalcState* cs = (CalcState*)win->app_data; CalcState* cs = (CalcState*)win->app_data;
if (!cs || !key.pressed) return; if (!cs || !key.pressed) return;
@@ -369,7 +369,7 @@ static void calculator_on_key(Window* win, const Zenith::KeyEvent& key) {
static void calculator_on_close(Window* win) { static void calculator_on_close(Window* win) {
if (win->app_data) { if (win->app_data) {
zenith::mfree(win->app_data); montauk::mfree(win->app_data);
win->app_data = nullptr; win->app_data = nullptr;
} }
} }
@@ -386,8 +386,8 @@ void open_calculator(DesktopState* ds) {
if (idx < 0) return; if (idx < 0) return;
Window* win = &ds->windows[idx]; Window* win = &ds->windows[idx];
CalcState* cs = (CalcState*)zenith::malloc(sizeof(CalcState)); CalcState* cs = (CalcState*)montauk::malloc(sizeof(CalcState));
zenith::memset(cs, 0, sizeof(CalcState)); montauk::memset(cs, 0, sizeof(CalcState));
cs->display_val = 0; cs->display_val = 0;
cs->accumulator = 0; cs->accumulator = 0;
cs->pending_op = 0; cs->pending_op = 0;
+9 -9
View File
@@ -1,6 +1,6 @@
/* /*
* app_devexplorer.cpp * app_devexplorer.cpp
* ZenithOS Desktop - Device Explorer (lists hardware detected by the kernel) * MontaukOS Desktop - Device Explorer (lists hardware detected by the kernel)
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -43,7 +43,7 @@ static Color category_colors[] = {
struct DevExplorerState { struct DevExplorerState {
DesktopState* desktop; DesktopState* desktop;
Zenith::DevInfo devs[DE_MAX_DEVS]; Montauk::DevInfo devs[DE_MAX_DEVS];
int dev_count; int dev_count;
bool collapsed[NUM_CATEGORIES]; // per-category collapse state bool collapsed[NUM_CATEGORIES]; // per-category collapse state
int selected_row; // index into visible display rows (-1 = none) int selected_row; // index into visible display rows (-1 = none)
@@ -130,11 +130,11 @@ static void devexplorer_on_poll(Window* win) {
DevExplorerState* de = (DevExplorerState*)win->app_data; DevExplorerState* de = (DevExplorerState*)win->app_data;
if (!de) return; if (!de) return;
uint64_t now = zenith::get_milliseconds(); uint64_t now = montauk::get_milliseconds();
if (now - de->last_poll_ms < DE_POLL_MS) return; if (now - de->last_poll_ms < DE_POLL_MS) return;
de->last_poll_ms = now; de->last_poll_ms = now;
de->dev_count = zenith::devlist(de->devs, DE_MAX_DEVS); de->dev_count = montauk::devlist(de->devs, DE_MAX_DEVS);
} }
static void devexplorer_on_draw(Window* win, Framebuffer& fb) { static void devexplorer_on_draw(Window* win, Framebuffer& fb) {
@@ -364,7 +364,7 @@ static void devexplorer_on_mouse(Window* win, MouseEvent& ev) {
} }
} }
static void devexplorer_on_key(Window* win, const Zenith::KeyEvent& key) { static void devexplorer_on_key(Window* win, const Montauk::KeyEvent& key) {
DevExplorerState* de = (DevExplorerState*)win->app_data; DevExplorerState* de = (DevExplorerState*)win->app_data;
if (!de || !key.pressed) return; if (!de || !key.pressed) return;
@@ -437,7 +437,7 @@ static void devexplorer_on_key(Window* win, const Zenith::KeyEvent& key) {
static void devexplorer_on_close(Window* win) { static void devexplorer_on_close(Window* win) {
if (win->app_data) { if (win->app_data) {
zenith::mfree(win->app_data); montauk::mfree(win->app_data);
win->app_data = nullptr; win->app_data = nullptr;
} }
} }
@@ -452,8 +452,8 @@ void open_devexplorer(DesktopState* ds) {
Window* win = &ds->windows[idx]; Window* win = &ds->windows[idx];
DevExplorerState* de = (DevExplorerState*)zenith::malloc(sizeof(DevExplorerState)); DevExplorerState* de = (DevExplorerState*)montauk::malloc(sizeof(DevExplorerState));
zenith::memset(de, 0, sizeof(DevExplorerState)); montauk::memset(de, 0, sizeof(DevExplorerState));
de->desktop = ds; de->desktop = ds;
de->selected_row = -1; de->selected_row = -1;
de->scroll_y = 0; de->scroll_y = 0;
@@ -464,7 +464,7 @@ void open_devexplorer(DesktopState* ds) {
de->collapsed[i] = false; de->collapsed[i] = false;
// Initial poll // Initial poll
de->dev_count = zenith::devlist(de->devs, DE_MAX_DEVS); de->dev_count = montauk::devlist(de->devs, DE_MAX_DEVS);
win->app_data = de; win->app_data = de;
win->on_draw = devexplorer_on_draw; win->on_draw = devexplorer_on_draw;
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* app_doom.cpp * app_doom.cpp
* ZenithOS Desktop - DOOM launcher (spawns standalone doom.elf) * MontaukOS Desktop - DOOM launcher (spawns standalone doom.elf)
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -8,5 +8,5 @@
void open_doom(DesktopState* ds) { void open_doom(DesktopState* ds) {
(void)ds; (void)ds;
zenith::spawn("0:/games/doom.elf"); montauk::spawn("0:/games/doom.elf");
} }
+40 -40
View File
@@ -1,6 +1,6 @@
/* /*
* app_filemanager.cpp * app_filemanager.cpp
* ZenithOS Desktop - Enhanced File Manager application * MontaukOS Desktop - Enhanced File Manager application
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -44,8 +44,8 @@ static constexpr int FM_GRID_PAD = 4;
// ============================================================================ // ============================================================================
static bool str_ends_with(const char* s, const char* suffix) { static bool str_ends_with(const char* s, const char* suffix) {
int slen = zenith::slen(s); int slen = montauk::slen(s);
int suflen = zenith::slen(suffix); int suflen = montauk::slen(suffix);
if (suflen > slen) return false; if (suflen > slen) return false;
for (int i = 0; i < suflen; i++) { for (int i = 0; i < suflen; i++) {
char sc = s[slen - suflen + i]; char sc = s[slen - suflen + i];
@@ -77,7 +77,7 @@ static int detect_file_type(const char* name, bool is_dir) {
static void filemanager_read_dir(FileManagerState* fm) { static void filemanager_read_dir(FileManagerState* fm) {
const char* names[64]; const char* names[64];
fm->entry_count = zenith::readdir(fm->current_path, names, 64); fm->entry_count = montauk::readdir(fm->current_path, names, 64);
if (fm->entry_count < 0) fm->entry_count = 0; if (fm->entry_count < 0) fm->entry_count = 0;
// readdir returns full paths from the VFS (e.g. "man/fetch.1" instead // readdir returns full paths from the VFS (e.g. "man/fetch.1" instead
@@ -92,8 +92,8 @@ static void filemanager_read_dir(FileManagerState* fm) {
char prefix[256] = {0}; char prefix[256] = {0};
int prefix_len = 0; int prefix_len = 0;
if (after_drive[0] != '\0') { if (after_drive[0] != '\0') {
zenith::strcpy(prefix, after_drive); montauk::strcpy(prefix, after_drive);
prefix_len = zenith::slen(prefix); prefix_len = montauk::slen(prefix);
if (prefix_len > 0 && prefix[prefix_len - 1] != '/') { if (prefix_len > 0 && prefix[prefix_len - 1] != '/') {
prefix[prefix_len++] = '/'; prefix[prefix_len++] = '/';
prefix[prefix_len] = '\0'; prefix[prefix_len] = '\0';
@@ -110,8 +110,8 @@ static void filemanager_read_dir(FileManagerState* fm) {
} }
if (match) raw += prefix_len; if (match) raw += prefix_len;
} }
zenith::strncpy(fm->entry_names[i], raw, 63); montauk::strncpy(fm->entry_names[i], raw, 63);
int len = zenith::slen(fm->entry_names[i]); int len = montauk::slen(fm->entry_names[i]);
// Detect directory // Detect directory
if (len > 0 && fm->entry_names[i][len - 1] == '/') { if (len > 0 && fm->entry_names[i][len - 1] == '/') {
@@ -131,16 +131,16 @@ static void filemanager_read_dir(FileManagerState* fm) {
fm->entry_sizes[i] = 0; fm->entry_sizes[i] = 0;
if (!fm->is_dir[i]) { if (!fm->is_dir[i]) {
char fullpath[512]; char fullpath[512];
zenith::strcpy(fullpath, fm->current_path); montauk::strcpy(fullpath, fm->current_path);
int plen = zenith::slen(fullpath); int plen = montauk::slen(fullpath);
if (plen > 0 && fullpath[plen - 1] != '/') { if (plen > 0 && fullpath[plen - 1] != '/') {
str_append(fullpath, "/", 512); str_append(fullpath, "/", 512);
} }
str_append(fullpath, fm->entry_names[i], 512); str_append(fullpath, fm->entry_names[i], 512);
int fd = zenith::open(fullpath); int fd = montauk::open(fullpath);
if (fd >= 0) { if (fd >= 0) {
fm->entry_sizes[i] = (int)zenith::getsize(fd); fm->entry_sizes[i] = (int)montauk::getsize(fd);
zenith::close(fd); montauk::close(fd);
} }
} }
} }
@@ -151,7 +151,7 @@ static void filemanager_read_dir(FileManagerState* fm) {
int tmp_type = fm->entry_types[i]; int tmp_type = fm->entry_types[i];
int tmp_size = fm->entry_sizes[i]; int tmp_size = fm->entry_sizes[i];
bool tmp_isdir = fm->is_dir[i]; bool tmp_isdir = fm->is_dir[i];
zenith::strcpy(tmp_name, fm->entry_names[i]); montauk::strcpy(tmp_name, fm->entry_names[i]);
int j = i - 1; int j = i - 1;
while (j >= 0) { while (j >= 0) {
@@ -165,13 +165,13 @@ static void filemanager_read_dir(FileManagerState* fm) {
} }
if (!swap) break; if (!swap) break;
zenith::strcpy(fm->entry_names[j + 1], fm->entry_names[j]); montauk::strcpy(fm->entry_names[j + 1], fm->entry_names[j]);
fm->entry_types[j + 1] = fm->entry_types[j]; fm->entry_types[j + 1] = fm->entry_types[j];
fm->entry_sizes[j + 1] = fm->entry_sizes[j]; fm->entry_sizes[j + 1] = fm->entry_sizes[j];
fm->is_dir[j + 1] = fm->is_dir[j]; fm->is_dir[j + 1] = fm->is_dir[j];
j--; j--;
} }
zenith::strcpy(fm->entry_names[j + 1], tmp_name); montauk::strcpy(fm->entry_names[j + 1], tmp_name);
fm->entry_types[j + 1] = tmp_type; fm->entry_types[j + 1] = tmp_type;
fm->entry_sizes[j + 1] = tmp_size; fm->entry_sizes[j + 1] = tmp_size;
fm->is_dir[j + 1] = tmp_isdir; fm->is_dir[j + 1] = tmp_isdir;
@@ -190,16 +190,16 @@ static void filemanager_read_dir(FileManagerState* fm) {
static void filemanager_push_history(FileManagerState* fm) { static void filemanager_push_history(FileManagerState* fm) {
// Don't push if same as current position // Don't push if same as current position
if (fm->history_count > 0 && fm->history_pos >= 0) { if (fm->history_count > 0 && fm->history_pos >= 0) {
if (zenith::streq(fm->history[fm->history_pos], fm->current_path)) return; if (montauk::streq(fm->history[fm->history_pos], fm->current_path)) return;
} }
fm->history_pos++; fm->history_pos++;
if (fm->history_pos >= 16) fm->history_pos = 15; if (fm->history_pos >= 16) fm->history_pos = 15;
zenith::strcpy(fm->history[fm->history_pos], fm->current_path); montauk::strcpy(fm->history[fm->history_pos], fm->current_path);
fm->history_count = fm->history_pos + 1; fm->history_count = fm->history_pos + 1;
} }
static void filemanager_navigate(FileManagerState* fm, const char* name) { static void filemanager_navigate(FileManagerState* fm, const char* name) {
int path_len = zenith::slen(fm->current_path); int path_len = montauk::slen(fm->current_path);
if (path_len > 0 && fm->current_path[path_len - 1] != '/') { if (path_len > 0 && fm->current_path[path_len - 1] != '/') {
str_append(fm->current_path, "/", 256); str_append(fm->current_path, "/", 256);
} }
@@ -209,7 +209,7 @@ static void filemanager_navigate(FileManagerState* fm, const char* name) {
} }
static void filemanager_go_up(FileManagerState* fm) { static void filemanager_go_up(FileManagerState* fm) {
int len = zenith::slen(fm->current_path); int len = montauk::slen(fm->current_path);
if (len <= 3) return; // "0:/" is root if (len <= 3) return; // "0:/" is root
if (len > 0 && fm->current_path[len - 1] == '/') { if (len > 0 && fm->current_path[len - 1] == '/') {
@@ -231,19 +231,19 @@ static void filemanager_go_up(FileManagerState* fm) {
static void filemanager_go_back(FileManagerState* fm) { static void filemanager_go_back(FileManagerState* fm) {
if (fm->history_pos <= 0) return; if (fm->history_pos <= 0) return;
fm->history_pos--; fm->history_pos--;
zenith::strcpy(fm->current_path, fm->history[fm->history_pos]); montauk::strcpy(fm->current_path, fm->history[fm->history_pos]);
filemanager_read_dir(fm); filemanager_read_dir(fm);
} }
static void filemanager_go_forward(FileManagerState* fm) { static void filemanager_go_forward(FileManagerState* fm) {
if (fm->history_pos >= fm->history_count - 1) return; if (fm->history_pos >= fm->history_count - 1) return;
fm->history_pos++; fm->history_pos++;
zenith::strcpy(fm->current_path, fm->history[fm->history_pos]); montauk::strcpy(fm->current_path, fm->history[fm->history_pos]);
filemanager_read_dir(fm); filemanager_read_dir(fm);
} }
static void filemanager_go_home(FileManagerState* fm) { static void filemanager_go_home(FileManagerState* fm) {
zenith::strcpy(fm->current_path, "0:/"); montauk::strcpy(fm->current_path, "0:/");
filemanager_push_history(fm); filemanager_push_history(fm);
filemanager_read_dir(fm); filemanager_read_dir(fm);
} }
@@ -368,14 +368,14 @@ static void filemanager_on_draw(Window* win, Framebuffer& fb) {
// Filename centered below icon, truncated if needed // Filename centered below icon, truncated if needed
char label[16]; char label[16];
int nlen = zenith::slen(fm->entry_names[i]); int nlen = montauk::slen(fm->entry_names[i]);
if (nlen > 9) { if (nlen > 9) {
for (int k = 0; k < 9; k++) label[k] = fm->entry_names[i][k]; for (int k = 0; k < 9; k++) label[k] = fm->entry_names[i][k];
label[9] = '.'; label[9] = '.';
label[10] = '.'; label[10] = '.';
label[11] = '\0'; label[11] = '\0';
} else { } else {
zenith::strncpy(label, fm->entry_names[i], 15); montauk::strncpy(label, fm->entry_names[i], 15);
} }
int tw = text_width(label); int tw = text_width(label);
int tx = cell_x + (FM_GRID_CELL_W - tw) / 2; int tx = cell_x + (FM_GRID_CELL_W - tw) / 2;
@@ -539,7 +539,7 @@ static void filemanager_on_mouse(Window* win, MouseEvent& ev) {
int clicked_idx = row * cols + col; int clicked_idx = row * cols + col;
if (clicked_idx >= 0 && clicked_idx < fm->entry_count && col < cols) { if (clicked_idx >= 0 && clicked_idx < fm->entry_count && col < cols) {
uint64_t now = zenith::get_milliseconds(); uint64_t now = montauk::get_milliseconds();
if (fm->last_click_item == clicked_idx && if (fm->last_click_item == clicked_idx &&
(now - fm->last_click_time) < 400) { (now - fm->last_click_time) < 400) {
@@ -547,16 +547,16 @@ static void filemanager_on_mouse(Window* win, MouseEvent& ev) {
filemanager_navigate(fm, fm->entry_names[clicked_idx]); filemanager_navigate(fm, fm->entry_names[clicked_idx]);
} else { } else {
char fullpath[512]; char fullpath[512];
zenith::strcpy(fullpath, fm->current_path); montauk::strcpy(fullpath, fm->current_path);
int plen = zenith::slen(fullpath); int plen = montauk::slen(fullpath);
if (plen > 0 && fullpath[plen - 1] != '/') { if (plen > 0 && fullpath[plen - 1] != '/') {
str_append(fullpath, "/", 512); str_append(fullpath, "/", 512);
} }
str_append(fullpath, fm->entry_names[clicked_idx], 512); str_append(fullpath, fm->entry_names[clicked_idx], 512);
if (is_image_file(fm->entry_names[clicked_idx])) { if (is_image_file(fm->entry_names[clicked_idx])) {
zenith::spawn("0:/os/imageviewer.elf", fullpath); montauk::spawn("0:/os/imageviewer.elf", fullpath);
} else if (is_font_file(fm->entry_names[clicked_idx])) { } else if (is_font_file(fm->entry_names[clicked_idx])) {
zenith::spawn("0:/os/fontpreview.elf", fullpath); montauk::spawn("0:/os/fontpreview.elf", fullpath);
} else if (fm->desktop) { } else if (fm->desktop) {
open_texteditor_with_file(fm->desktop, fullpath); open_texteditor_with_file(fm->desktop, fullpath);
} }
@@ -578,7 +578,7 @@ static void filemanager_on_mouse(Window* win, MouseEvent& ev) {
int clicked_idx = rel_y / FM_ITEM_H; int clicked_idx = rel_y / FM_ITEM_H;
if (clicked_idx >= 0 && clicked_idx < fm->entry_count) { if (clicked_idx >= 0 && clicked_idx < fm->entry_count) {
uint64_t now = zenith::get_milliseconds(); uint64_t now = montauk::get_milliseconds();
// Double-click detection // Double-click detection
if (fm->last_click_item == clicked_idx && if (fm->last_click_item == clicked_idx &&
@@ -588,16 +588,16 @@ static void filemanager_on_mouse(Window* win, MouseEvent& ev) {
} else { } else {
// Open file in appropriate viewer // Open file in appropriate viewer
char fullpath[512]; char fullpath[512];
zenith::strcpy(fullpath, fm->current_path); montauk::strcpy(fullpath, fm->current_path);
int plen = zenith::slen(fullpath); int plen = montauk::slen(fullpath);
if (plen > 0 && fullpath[plen - 1] != '/') { if (plen > 0 && fullpath[plen - 1] != '/') {
str_append(fullpath, "/", 512); str_append(fullpath, "/", 512);
} }
str_append(fullpath, fm->entry_names[clicked_idx], 512); str_append(fullpath, fm->entry_names[clicked_idx], 512);
if (is_image_file(fm->entry_names[clicked_idx])) { if (is_image_file(fm->entry_names[clicked_idx])) {
zenith::spawn("0:/os/imageviewer.elf", fullpath); montauk::spawn("0:/os/imageviewer.elf", fullpath);
} else if (is_font_file(fm->entry_names[clicked_idx])) { } else if (is_font_file(fm->entry_names[clicked_idx])) {
zenith::spawn("0:/os/fontpreview.elf", fullpath); montauk::spawn("0:/os/fontpreview.elf", fullpath);
} else if (fm->desktop) { } else if (fm->desktop) {
open_texteditor_with_file(fm->desktop, fullpath); open_texteditor_with_file(fm->desktop, fullpath);
} }
@@ -633,7 +633,7 @@ static void filemanager_on_mouse(Window* win, MouseEvent& ev) {
// Keyboard handling // Keyboard handling
// ============================================================================ // ============================================================================
static void filemanager_on_key(Window* win, const Zenith::KeyEvent& key) { static void filemanager_on_key(Window* win, const Montauk::KeyEvent& key) {
FileManagerState* fm = (FileManagerState*)win->app_data; FileManagerState* fm = (FileManagerState*)win->app_data;
if (!fm || !key.pressed) return; if (!fm || !key.pressed) return;
@@ -682,7 +682,7 @@ static void filemanager_on_key(Window* win, const Zenith::KeyEvent& key) {
static void filemanager_on_close(Window* win) { static void filemanager_on_close(Window* win) {
if (win->app_data) { if (win->app_data) {
zenith::mfree(win->app_data); montauk::mfree(win->app_data);
win->app_data = nullptr; win->app_data = nullptr;
} }
} }
@@ -696,9 +696,9 @@ void open_filemanager(DesktopState* ds) {
if (idx < 0) return; if (idx < 0) return;
Window* win = &ds->windows[idx]; Window* win = &ds->windows[idx];
FileManagerState* fm = (FileManagerState*)zenith::malloc(sizeof(FileManagerState)); FileManagerState* fm = (FileManagerState*)montauk::malloc(sizeof(FileManagerState));
zenith::memset(fm, 0, sizeof(FileManagerState)); montauk::memset(fm, 0, sizeof(FileManagerState));
zenith::strcpy(fm->current_path, "0:/"); montauk::strcpy(fm->current_path, "0:/");
fm->selected = -1; fm->selected = -1;
fm->last_click_item = -1; fm->last_click_item = -1;
fm->history_pos = -1; fm->history_pos = -1;
+12 -12
View File
@@ -1,6 +1,6 @@
/* /*
* app_klog.cpp * app_klog.cpp
* ZenithOS Desktop - Kernel Log viewer (tails the kernel ring buffer) * MontaukOS Desktop - Kernel Log viewer (tails the kernel ring buffer)
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -64,7 +64,7 @@ static void klog_on_mouse(Window* win, MouseEvent& ev) {
// Read-only viewer — no mouse interaction needed // Read-only viewer — no mouse interaction needed
} }
static void klog_on_key(Window* win, const Zenith::KeyEvent& key) { static void klog_on_key(Window* win, const Montauk::KeyEvent& key) {
// Read-only viewer — no keyboard input // Read-only viewer — no keyboard input
} }
@@ -72,11 +72,11 @@ static void klog_on_poll(Window* win) {
KlogState* klog = (KlogState*)win->app_data; KlogState* klog = (KlogState*)win->app_data;
if (!klog) return; if (!klog) return;
uint64_t now = zenith::get_milliseconds(); uint64_t now = montauk::get_milliseconds();
if (now - klog->last_poll_ms < KLOG_POLL_MS) return; if (now - klog->last_poll_ms < KLOG_POLL_MS) return;
klog->last_poll_ms = now; klog->last_poll_ms = now;
int n = (int)zenith::read_klog(klog->klog_buf, KLOG_READ_SIZE); int n = (int)montauk::read_klog(klog->klog_buf, KLOG_READ_SIZE);
if (n <= 0 && klog->last_len <= 0) return; if (n <= 0 && klog->last_len <= 0) return;
if (n > klog->last_len) { if (n > klog->last_len) {
@@ -101,10 +101,10 @@ static void klog_on_poll(Window* win) {
static void klog_on_close(Window* win) { static void klog_on_close(Window* win) {
KlogState* klog = (KlogState*)win->app_data; KlogState* klog = (KlogState*)win->app_data;
if (klog) { if (klog) {
if (klog->term.cells) zenith::mfree(klog->term.cells); if (klog->term.cells) montauk::mfree(klog->term.cells);
if (klog->term.alt_cells) zenith::mfree(klog->term.alt_cells); if (klog->term.alt_cells) montauk::mfree(klog->term.alt_cells);
if (klog->klog_buf) zenith::mfree(klog->klog_buf); if (klog->klog_buf) montauk::mfree(klog->klog_buf);
zenith::mfree(klog); montauk::mfree(klog);
win->app_data = nullptr; win->app_data = nullptr;
} }
} }
@@ -122,20 +122,20 @@ void open_klog(DesktopState* ds) {
int cols = cr.w / mono_cell_width(); int cols = cr.w / mono_cell_width();
int rows = cr.h / mono_cell_height(); int rows = cr.h / mono_cell_height();
KlogState* klog = (KlogState*)zenith::malloc(sizeof(KlogState)); KlogState* klog = (KlogState*)montauk::malloc(sizeof(KlogState));
zenith::memset(klog, 0, sizeof(KlogState)); montauk::memset(klog, 0, sizeof(KlogState));
// Initialize the terminal cell grid (reuse terminal infrastructure) // Initialize the terminal cell grid (reuse terminal infrastructure)
terminal_init_cells(&klog->term, cols, rows); terminal_init_cells(&klog->term, cols, rows);
// Allocate klog read buffer // Allocate klog read buffer
klog->klog_buf = (char*)zenith::malloc(KLOG_READ_SIZE); klog->klog_buf = (char*)montauk::malloc(KLOG_READ_SIZE);
klog->last_len = 0; klog->last_len = 0;
klog->last_tail_byte = 0; klog->last_tail_byte = 0;
klog->last_poll_ms = 0; klog->last_poll_ms = 0;
// Do an initial read to show existing log content // Do an initial read to show existing log content
int n = (int)zenith::read_klog(klog->klog_buf, KLOG_READ_SIZE); int n = (int)montauk::read_klog(klog->klog_buf, KLOG_READ_SIZE);
if (n > 0) { if (n > 0) {
klog_refeed(klog, n); klog_refeed(klog, n);
klog->last_len = n; klog->last_len = n;
+5 -5
View File
@@ -1,6 +1,6 @@
/* /*
* app_mandelbrot.cpp * app_mandelbrot.cpp
* ZenithOS Desktop - Mandelbrot set visualizer * MontaukOS Desktop - Mandelbrot set visualizer
* Supports zoom (scroll wheel), pan (drag), and reset (R key) * Supports zoom (scroll wheel), pan (drag), and reset (R key)
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -242,7 +242,7 @@ static void mb_on_mouse(Window* win, MouseEvent& ev) {
} }
} }
static void mb_on_key(Window* win, const Zenith::KeyEvent& key) { static void mb_on_key(Window* win, const Montauk::KeyEvent& key) {
MandelbrotState* mb = (MandelbrotState*)win->app_data; MandelbrotState* mb = (MandelbrotState*)win->app_data;
if (!mb || !key.pressed) return; if (!mb || !key.pressed) return;
@@ -262,7 +262,7 @@ static void mb_on_key(Window* win, const Zenith::KeyEvent& key) {
static void mb_on_close(Window* win) { static void mb_on_close(Window* win) {
if (win->app_data) { if (win->app_data) {
zenith::mfree(win->app_data); montauk::mfree(win->app_data);
win->app_data = nullptr; win->app_data = nullptr;
} }
} }
@@ -278,8 +278,8 @@ void open_mandelbrot(DesktopState* ds) {
Window* win = &ds->windows[idx]; Window* win = &ds->windows[idx];
Rect cr = win->content_rect(); Rect cr = win->content_rect();
MandelbrotState* mb = (MandelbrotState*)zenith::malloc(sizeof(MandelbrotState)); MandelbrotState* mb = (MandelbrotState*)montauk::malloc(sizeof(MandelbrotState));
zenith::memset(mb, 0, sizeof(MandelbrotState)); montauk::memset(mb, 0, sizeof(MandelbrotState));
mb->desktop = ds; mb->desktop = ds;
mb->center_x = -fp_from_int(1) / 2; // -0.5 mb->center_x = -fp_from_int(1) / 2; // -0.5
mb->center_y = 0; mb->center_y = 0;
+11 -11
View File
@@ -1,6 +1,6 @@
/* /*
* app_procmgr.cpp * app_procmgr.cpp
* ZenithOS Desktop - Process Manager * MontaukOS Desktop - Process Manager
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -18,7 +18,7 @@ static constexpr int PM_POLL_MS = 1000;
struct ProcMgrState { struct ProcMgrState {
DesktopState* desktop; DesktopState* desktop;
Zenith::ProcInfo procs[PM_MAX_PROCS]; Montauk::ProcInfo procs[PM_MAX_PROCS];
int proc_count; int proc_count;
int selected; // selected row index (-1 = none) int selected; // selected row index (-1 = none)
uint64_t last_poll_ms; uint64_t last_poll_ms;
@@ -32,7 +32,7 @@ static void procmgr_on_poll(Window* win) {
ProcMgrState* pm = (ProcMgrState*)win->app_data; ProcMgrState* pm = (ProcMgrState*)win->app_data;
if (!pm) return; if (!pm) return;
uint64_t now = zenith::get_milliseconds(); uint64_t now = montauk::get_milliseconds();
if (now - pm->last_poll_ms < PM_POLL_MS) return; if (now - pm->last_poll_ms < PM_POLL_MS) return;
pm->last_poll_ms = now; pm->last_poll_ms = now;
@@ -42,7 +42,7 @@ static void procmgr_on_poll(Window* win) {
prev_pid = pm->procs[pm->selected].pid; prev_pid = pm->procs[pm->selected].pid;
} }
pm->proc_count = zenith::proclist(pm->procs, PM_MAX_PROCS); pm->proc_count = montauk::proclist(pm->procs, PM_MAX_PROCS);
// Restore selection by matching PID // Restore selection by matching PID
pm->selected = -1; pm->selected = -1;
@@ -172,7 +172,7 @@ static void procmgr_on_mouse(Window* win, MouseEvent& ev) {
if (btn_rect.contains(lx, ly)) { if (btn_rect.contains(lx, ly)) {
if (pm->selected >= 0 && pm->selected < pm->proc_count if (pm->selected >= 0 && pm->selected < pm->proc_count
&& pm->procs[pm->selected].pid != 0) { && pm->procs[pm->selected].pid != 0) {
zenith::kill(pm->procs[pm->selected].pid); montauk::kill(pm->procs[pm->selected].pid);
pm->last_poll_ms = 0; // force refresh pm->last_poll_ms = 0; // force refresh
} }
return; return;
@@ -191,7 +191,7 @@ static void procmgr_on_mouse(Window* win, MouseEvent& ev) {
} }
} }
static void procmgr_on_key(Window* win, const Zenith::KeyEvent& key) { static void procmgr_on_key(Window* win, const Montauk::KeyEvent& key) {
ProcMgrState* pm = (ProcMgrState*)win->app_data; ProcMgrState* pm = (ProcMgrState*)win->app_data;
if (!pm || !key.pressed) return; if (!pm || !key.pressed) return;
@@ -203,7 +203,7 @@ static void procmgr_on_key(Window* win, const Zenith::KeyEvent& key) {
} else if (key.scancode == 0x53) { // Delete key } else if (key.scancode == 0x53) { // Delete key
if (pm->selected >= 0 && pm->selected < pm->proc_count if (pm->selected >= 0 && pm->selected < pm->proc_count
&& pm->procs[pm->selected].pid != 0) { && pm->procs[pm->selected].pid != 0) {
zenith::kill(pm->procs[pm->selected].pid); montauk::kill(pm->procs[pm->selected].pid);
pm->last_poll_ms = 0; // force refresh pm->last_poll_ms = 0; // force refresh
} }
} }
@@ -211,7 +211,7 @@ static void procmgr_on_key(Window* win, const Zenith::KeyEvent& key) {
static void procmgr_on_close(Window* win) { static void procmgr_on_close(Window* win) {
if (win->app_data) { if (win->app_data) {
zenith::mfree(win->app_data); montauk::mfree(win->app_data);
win->app_data = nullptr; win->app_data = nullptr;
} }
} }
@@ -226,14 +226,14 @@ void open_procmgr(DesktopState* ds) {
Window* win = &ds->windows[idx]; Window* win = &ds->windows[idx];
ProcMgrState* pm = (ProcMgrState*)zenith::malloc(sizeof(ProcMgrState)); ProcMgrState* pm = (ProcMgrState*)montauk::malloc(sizeof(ProcMgrState));
zenith::memset(pm, 0, sizeof(ProcMgrState)); montauk::memset(pm, 0, sizeof(ProcMgrState));
pm->desktop = ds; pm->desktop = ds;
pm->selected = -1; pm->selected = -1;
pm->last_poll_ms = 0; pm->last_poll_ms = 0;
// Initial poll // Initial poll
pm->proc_count = zenith::proclist(pm->procs, PM_MAX_PROCS); pm->proc_count = montauk::proclist(pm->procs, PM_MAX_PROCS);
win->app_data = pm; win->app_data = pm;
win->on_draw = procmgr_on_draw; win->on_draw = procmgr_on_draw;
+17 -17
View File
@@ -1,6 +1,6 @@
/* /*
* app_settings.cpp * app_settings.cpp
* ZenithOS Desktop - Settings application * MontaukOS Desktop - Settings application
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -14,7 +14,7 @@
struct SettingsState { struct SettingsState {
DesktopState* desktop; DesktopState* desktop;
int active_tab; // 0=Appearance, 1=Display, 2=About int active_tab; // 0=Appearance, 1=Display, 2=About
Zenith::SysInfo sys_info; Montauk::SysInfo sys_info;
uint64_t uptime_ms; uint64_t uptime_ms;
WallpaperFileList wp_files; WallpaperFileList wp_files;
bool wp_scanned; bool wp_scanned;
@@ -180,11 +180,11 @@ static void settings_draw_appearance(Canvas& c, SettingsState* st) {
for (int i = 0; i < st->wp_files.count && i < 8; i++) { for (int i = 0; i < st->wp_files.count && i < 8; i++) {
// Build full path for comparison // Build full path for comparison
char fullpath[256]; char fullpath[256];
zenith::strcpy(fullpath, "0:/home/"); montauk::strcpy(fullpath, "0:/home/");
str_append(fullpath, st->wp_files.names[i], 256); str_append(fullpath, st->wp_files.names[i], 256);
bool selected = s.bg_image && bool selected = s.bg_image &&
zenith::streq(s.bg_image_path, fullpath); montauk::streq(s.bg_image_path, fullpath);
if (selected) { if (selected) {
c.fill_rounded_rect(x, y, c.w - 2 * x, WP_ITEM_H, 3, accent); c.fill_rounded_rect(x, y, c.w - 2 * x, WP_ITEM_H, 3, accent);
@@ -192,15 +192,15 @@ static void settings_draw_appearance(Canvas& c, SettingsState* st) {
// Truncate long filenames // Truncate long filenames
char label[40]; char label[40];
int nlen = zenith::slen(st->wp_files.names[i]); int nlen = montauk::slen(st->wp_files.names[i]);
if (nlen > 35) { if (nlen > 35) {
zenith::strncpy(label, st->wp_files.names[i], 32); montauk::strncpy(label, st->wp_files.names[i], 32);
label[32] = '.'; label[32] = '.';
label[33] = '.'; label[33] = '.';
label[34] = '.'; label[34] = '.';
label[35] = '\0'; label[35] = '\0';
} else { } else {
zenith::strncpy(label, st->wp_files.names[i], 39); montauk::strncpy(label, st->wp_files.names[i], 39);
} }
Color tc = selected ? colors::WHITE : colors::TEXT_COLOR; Color tc = selected ? colors::WHITE : colors::TEXT_COLOR;
@@ -292,7 +292,7 @@ static void settings_draw_display(Canvas& c, SettingsState* st) {
} }
static void settings_draw_about(Canvas& c, SettingsState* st) { static void settings_draw_about(Canvas& c, SettingsState* st) {
st->uptime_ms = zenith::get_milliseconds(); st->uptime_ms = montauk::get_milliseconds();
Color dim = Color::from_rgb(0x88, 0x88, 0x88); Color dim = Color::from_rgb(0x88, 0x88, 0x88);
int x = 16; int x = 16;
@@ -463,7 +463,7 @@ static void settings_on_mouse(Window* win, MouseEvent& ev) {
mx >= x && mx < win->content_w - x) { mx >= x && mx < win->content_w - x) {
// Build full path and load wallpaper // Build full path and load wallpaper
char fullpath[256]; char fullpath[256];
zenith::strcpy(fullpath, "0:/home/"); montauk::strcpy(fullpath, "0:/home/");
str_append(fullpath, st->wp_files.names[i], 256); str_append(fullpath, st->wp_files.names[i], 256);
wallpaper_load(&s, fullpath, wallpaper_load(&s, fullpath,
st->desktop->screen_w, st->desktop->screen_h); st->desktop->screen_w, st->desktop->screen_h);
@@ -552,21 +552,21 @@ static void settings_on_mouse(Window* win, MouseEvent& ev) {
if (mx >= bx && mx < bx + sbw && cy >= y && cy < y + btn_h) { if (mx >= bx && mx < bx + sbw && cy >= y && cy < y + btn_h) {
s.ui_scale = 0; s.ui_scale = 0;
apply_ui_scale(0); apply_ui_scale(0);
zenith::win_setscale(0); montauk::win_setscale(0);
return; return;
} }
// Default // Default
if (mx >= bx + sbw + 8 && mx < bx + sbw * 2 + 8 && cy >= y && cy < y + btn_h) { if (mx >= bx + sbw + 8 && mx < bx + sbw * 2 + 8 && cy >= y && cy < y + btn_h) {
s.ui_scale = 1; s.ui_scale = 1;
apply_ui_scale(1); apply_ui_scale(1);
zenith::win_setscale(1); montauk::win_setscale(1);
return; return;
} }
// Large // Large
if (mx >= bx + (sbw + 8) * 2 && mx < bx + sbw * 3 + 16 && cy >= y && cy < y + btn_h) { if (mx >= bx + (sbw + 8) * 2 && mx < bx + sbw * 3 + 16 && cy >= y && cy < y + btn_h) {
s.ui_scale = 2; s.ui_scale = 2;
apply_ui_scale(2); apply_ui_scale(2);
zenith::win_setscale(2); montauk::win_setscale(2);
return; return;
} }
} }
@@ -578,7 +578,7 @@ static void settings_on_mouse(Window* win, MouseEvent& ev) {
static void settings_on_close(Window* win) { static void settings_on_close(Window* win) {
if (win->app_data) { if (win->app_data) {
zenith::mfree(win->app_data); montauk::mfree(win->app_data);
win->app_data = nullptr; win->app_data = nullptr;
} }
} }
@@ -592,12 +592,12 @@ void open_settings(DesktopState* ds) {
if (idx < 0) return; if (idx < 0) return;
Window* win = &ds->windows[idx]; Window* win = &ds->windows[idx];
SettingsState* st = (SettingsState*)zenith::malloc(sizeof(SettingsState)); SettingsState* st = (SettingsState*)montauk::malloc(sizeof(SettingsState));
zenith::memset(st, 0, sizeof(SettingsState)); montauk::memset(st, 0, sizeof(SettingsState));
st->desktop = ds; st->desktop = ds;
st->active_tab = 0; st->active_tab = 0;
zenith::get_info(&st->sys_info); montauk::get_info(&st->sys_info);
st->uptime_ms = zenith::get_milliseconds(); st->uptime_ms = montauk::get_milliseconds();
st->wp_scanned = false; st->wp_scanned = false;
st->wp_files.count = 0; st->wp_files.count = 0;
+10 -10
View File
@@ -1,6 +1,6 @@
/* /*
* app_sysinfo.cpp * app_sysinfo.cpp
* ZenithOS Desktop - System Info application * MontaukOS Desktop - System Info application
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -11,8 +11,8 @@
// ============================================================================ // ============================================================================
struct SysInfoState { struct SysInfoState {
Zenith::SysInfo sys_info; Montauk::SysInfo sys_info;
Zenith::NetCfg net_cfg; Montauk::NetCfg net_cfg;
uint64_t uptime_ms; uint64_t uptime_ms;
}; };
@@ -20,7 +20,7 @@ static void sysinfo_on_draw(Window* win, Framebuffer& fb) {
SysInfoState* si = (SysInfoState*)win->app_data; SysInfoState* si = (SysInfoState*)win->app_data;
if (!si) return; if (!si) return;
si->uptime_ms = zenith::get_milliseconds(); si->uptime_ms = montauk::get_milliseconds();
Canvas c(win); Canvas c(win);
c.fill(colors::WINDOW_BG); c.fill(colors::WINDOW_BG);
@@ -107,7 +107,7 @@ static void sysinfo_on_draw(Window* win, Framebuffer& fb) {
static void sysinfo_on_close(Window* win) { static void sysinfo_on_close(Window* win) {
if (win->app_data) { if (win->app_data) {
zenith::mfree(win->app_data); montauk::mfree(win->app_data);
win->app_data = nullptr; win->app_data = nullptr;
} }
} }
@@ -121,11 +121,11 @@ void open_sysinfo(DesktopState* ds) {
if (idx < 0) return; if (idx < 0) return;
Window* win = &ds->windows[idx]; Window* win = &ds->windows[idx];
SysInfoState* si = (SysInfoState*)zenith::malloc(sizeof(SysInfoState)); SysInfoState* si = (SysInfoState*)montauk::malloc(sizeof(SysInfoState));
zenith::memset(si, 0, sizeof(SysInfoState)); montauk::memset(si, 0, sizeof(SysInfoState));
zenith::get_info(&si->sys_info); montauk::get_info(&si->sys_info);
zenith::get_netcfg(&si->net_cfg); montauk::get_netcfg(&si->net_cfg);
si->uptime_ms = zenith::get_milliseconds(); si->uptime_ms = montauk::get_milliseconds();
win->app_data = si; win->app_data = si;
win->on_draw = sysinfo_on_draw; win->on_draw = sysinfo_on_draw;
+6 -6
View File
@@ -1,6 +1,6 @@
/* /*
* app_terminal.cpp * app_terminal.cpp
* ZenithOS Desktop - Terminal application * MontaukOS Desktop - Terminal application
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -30,7 +30,7 @@ static void terminal_on_mouse(Window* win, MouseEvent& ev) {
// Terminal doesn't need mouse handling for now // Terminal doesn't need mouse handling for now
} }
static void terminal_on_key(Window* win, const Zenith::KeyEvent& key) { static void terminal_on_key(Window* win, const Montauk::KeyEvent& key) {
TerminalState* ts = (TerminalState*)win->app_data; TerminalState* ts = (TerminalState*)win->app_data;
if (!ts) return; if (!ts) return;
terminal_handle_key(ts, key); terminal_handle_key(ts, key);
@@ -39,8 +39,8 @@ static void terminal_on_key(Window* win, const Zenith::KeyEvent& key) {
static void terminal_on_close(Window* win) { static void terminal_on_close(Window* win) {
TerminalState* ts = (TerminalState*)win->app_data; TerminalState* ts = (TerminalState*)win->app_data;
if (ts) { if (ts) {
if (ts->cells) zenith::mfree(ts->cells); if (ts->cells) montauk::mfree(ts->cells);
zenith::mfree(ts); montauk::mfree(ts);
win->app_data = nullptr; win->app_data = nullptr;
} }
} }
@@ -63,8 +63,8 @@ void open_terminal(DesktopState* ds) {
int cols = cr.w / mono_cell_width(); int cols = cr.w / mono_cell_width();
int rows = cr.h / mono_cell_height(); int rows = cr.h / mono_cell_height();
TerminalState* ts = (TerminalState*)zenith::malloc(sizeof(TerminalState)); TerminalState* ts = (TerminalState*)montauk::malloc(sizeof(TerminalState));
zenith::memset(ts, 0, sizeof(TerminalState)); montauk::memset(ts, 0, sizeof(TerminalState));
terminal_init(ts, cols, rows); terminal_init(ts, cols, rows);
win->app_data = ts; win->app_data = ts;
+30 -30
View File
@@ -1,6 +1,6 @@
/* /*
* app_texteditor.cpp * app_texteditor.cpp
* ZenithOS Desktop - Text Editor application * MontaukOS Desktop - Text Editor application
* Single-buffer text editor with line numbers, cursor, scrolling, file I/O * Single-buffer text editor with line numbers, cursor, scrolling, file I/O
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -48,7 +48,7 @@ struct TextEditorState {
static void te_recompute_lines(TextEditorState* te) { static void te_recompute_lines(TextEditorState* te) {
if (!te->line_offsets) { if (!te->line_offsets) {
te->line_offsets = (int*)zenith::malloc(TE_MAX_LINES * sizeof(int)); te->line_offsets = (int*)montauk::malloc(TE_MAX_LINES * sizeof(int));
} }
te->line_count = 0; te->line_count = 0;
@@ -94,7 +94,7 @@ static void te_ensure_capacity(TextEditorState* te, int needed) {
int new_cap = te->buf_cap * 2; int new_cap = te->buf_cap * 2;
if (new_cap > TE_MAX_CAP) new_cap = TE_MAX_CAP; if (new_cap > TE_MAX_CAP) new_cap = TE_MAX_CAP;
if (new_cap < te->buf_len + needed) new_cap = te->buf_len + needed; if (new_cap < te->buf_len + needed) new_cap = te->buf_len + needed;
te->buffer = (char*)zenith::realloc(te->buffer, new_cap); te->buffer = (char*)montauk::realloc(te->buffer, new_cap);
te->buf_cap = new_cap; te->buf_cap = new_cap;
} }
@@ -236,21 +236,21 @@ static void te_ensure_cursor_visible(TextEditorState* te, int visible_lines, int
// ============================================================================ // ============================================================================
static void te_load_file(TextEditorState* te, const char* path) { static void te_load_file(TextEditorState* te, const char* path) {
int fd = zenith::open(path); int fd = montauk::open(path);
if (fd < 0) return; if (fd < 0) return;
uint64_t size = zenith::getsize(fd); uint64_t size = montauk::getsize(fd);
if (size > TE_MAX_CAP) size = TE_MAX_CAP; if (size > TE_MAX_CAP) size = TE_MAX_CAP;
if ((int)size >= te->buf_cap) { if ((int)size >= te->buf_cap) {
int new_cap = (int)size + 1024; int new_cap = (int)size + 1024;
if (new_cap > TE_MAX_CAP) new_cap = TE_MAX_CAP; if (new_cap > TE_MAX_CAP) new_cap = TE_MAX_CAP;
te->buffer = (char*)zenith::realloc(te->buffer, new_cap); te->buffer = (char*)montauk::realloc(te->buffer, new_cap);
te->buf_cap = new_cap; te->buf_cap = new_cap;
} }
zenith::read(fd, (uint8_t*)te->buffer, 0, size); montauk::read(fd, (uint8_t*)te->buffer, 0, size);
zenith::close(fd); montauk::close(fd);
te->buf_len = (int)size; te->buf_len = (int)size;
te->cursor_pos = 0; te->cursor_pos = 0;
@@ -258,7 +258,7 @@ static void te_load_file(TextEditorState* te, const char* path) {
te->scroll_x = 0; te->scroll_x = 0;
te->modified = false; te->modified = false;
zenith::strncpy(te->filepath, path, 255); montauk::strncpy(te->filepath, path, 255);
// Extract filename from path // Extract filename from path
int last_slash = -1; int last_slash = -1;
@@ -266,9 +266,9 @@ static void te_load_file(TextEditorState* te, const char* path) {
if (path[i] == '/') last_slash = i; if (path[i] == '/') last_slash = i;
} }
if (last_slash >= 0) { if (last_slash >= 0) {
zenith::strncpy(te->filename, path + last_slash + 1, 63); montauk::strncpy(te->filename, path + last_slash + 1, 63);
} else { } else {
zenith::strncpy(te->filename, path, 63); montauk::strncpy(te->filename, path, 63);
} }
te_recompute_lines(te); te_recompute_lines(te);
@@ -278,11 +278,11 @@ static void te_load_file(TextEditorState* te, const char* path) {
static void te_save_file(TextEditorState* te) { static void te_save_file(TextEditorState* te) {
if (te->filepath[0] == '\0') return; if (te->filepath[0] == '\0') return;
int fd = zenith::fcreate(te->filepath); int fd = montauk::fcreate(te->filepath);
if (fd < 0) return; if (fd < 0) return;
zenith::fwrite(fd, (const uint8_t*)te->buffer, 0, te->buf_len); montauk::fwrite(fd, (const uint8_t*)te->buffer, 0, te->buf_len);
zenith::close(fd); montauk::close(fd);
te->modified = false; te->modified = false;
} }
@@ -502,8 +502,8 @@ static void texteditor_on_mouse(Window* win, MouseEvent& ev) {
te->show_pathbar = !te->show_pathbar; te->show_pathbar = !te->show_pathbar;
if (te->show_pathbar) { if (te->show_pathbar) {
// Pre-fill with current filepath // Pre-fill with current filepath
zenith::strncpy(te->pathbar_text, te->filepath, 255); montauk::strncpy(te->pathbar_text, te->filepath, 255);
te->pathbar_len = zenith::slen(te->pathbar_text); te->pathbar_len = montauk::slen(te->pathbar_text);
te->pathbar_cursor = te->pathbar_len; te->pathbar_cursor = te->pathbar_len;
} }
return; return;
@@ -529,7 +529,7 @@ static void texteditor_on_mouse(Window* win, MouseEvent& ev) {
// Update window title // Update window title
char title[64]; char title[64];
snprintf(title, 64, "%s - Editor", te->filename); snprintf(title, 64, "%s - Editor", te->filename);
zenith::strncpy(win->title, title, 63); montauk::strncpy(win->title, title, 63);
te->show_pathbar = false; te->show_pathbar = false;
} }
} }
@@ -566,7 +566,7 @@ static void texteditor_on_mouse(Window* win, MouseEvent& ev) {
// Keyboard handling // Keyboard handling
// ============================================================================ // ============================================================================
static void texteditor_on_key(Window* win, const Zenith::KeyEvent& key) { static void texteditor_on_key(Window* win, const Montauk::KeyEvent& key) {
TextEditorState* te = (TextEditorState*)win->app_data; TextEditorState* te = (TextEditorState*)win->app_data;
if (!te || !key.pressed) return; if (!te || !key.pressed) return;
@@ -577,7 +577,7 @@ static void texteditor_on_key(Window* win, const Zenith::KeyEvent& key) {
te_load_file(te, te->pathbar_text); te_load_file(te, te->pathbar_text);
char title[64]; char title[64];
snprintf(title, 64, "%s - Editor", te->filename); snprintf(title, 64, "%s - Editor", te->filename);
zenith::strncpy(win->title, title, 63); montauk::strncpy(win->title, title, 63);
te->show_pathbar = false; te->show_pathbar = false;
} }
return; return;
@@ -628,8 +628,8 @@ static void texteditor_on_key(Window* win, const Zenith::KeyEvent& key) {
if (key.ctrl && (key.ascii == 'o' || key.ascii == 'O')) { if (key.ctrl && (key.ascii == 'o' || key.ascii == 'O')) {
te->show_pathbar = !te->show_pathbar; te->show_pathbar = !te->show_pathbar;
if (te->show_pathbar) { if (te->show_pathbar) {
zenith::strncpy(te->pathbar_text, te->filepath, 255); montauk::strncpy(te->pathbar_text, te->filepath, 255);
te->pathbar_len = zenith::slen(te->pathbar_text); te->pathbar_len = montauk::slen(te->pathbar_text);
te->pathbar_cursor = te->pathbar_len; te->pathbar_cursor = te->pathbar_len;
} }
return; return;
@@ -678,9 +678,9 @@ static void texteditor_on_key(Window* win, const Zenith::KeyEvent& key) {
static void texteditor_on_close(Window* win) { static void texteditor_on_close(Window* win) {
TextEditorState* te = (TextEditorState*)win->app_data; TextEditorState* te = (TextEditorState*)win->app_data;
if (te) { if (te) {
if (te->buffer) zenith::mfree(te->buffer); if (te->buffer) montauk::mfree(te->buffer);
if (te->line_offsets) zenith::mfree(te->line_offsets); if (te->line_offsets) montauk::mfree(te->line_offsets);
zenith::mfree(te); montauk::mfree(te);
win->app_data = nullptr; win->app_data = nullptr;
} }
} }
@@ -694,10 +694,10 @@ void open_texteditor(DesktopState* ds) {
if (idx < 0) return; if (idx < 0) return;
Window* win = &ds->windows[idx]; Window* win = &ds->windows[idx];
TextEditorState* te = (TextEditorState*)zenith::malloc(sizeof(TextEditorState)); TextEditorState* te = (TextEditorState*)montauk::malloc(sizeof(TextEditorState));
zenith::memset(te, 0, sizeof(TextEditorState)); montauk::memset(te, 0, sizeof(TextEditorState));
te->buffer = (char*)zenith::malloc(TE_INIT_CAP); te->buffer = (char*)montauk::malloc(TE_INIT_CAP);
te->buf_cap = TE_INIT_CAP; te->buf_cap = TE_INIT_CAP;
te->buf_len = 0; te->buf_len = 0;
te->modified = false; te->modified = false;
@@ -731,10 +731,10 @@ void open_texteditor_with_file(DesktopState* ds, const char* path) {
if (idx < 0) return; if (idx < 0) return;
Window* win = &ds->windows[idx]; Window* win = &ds->windows[idx];
TextEditorState* te = (TextEditorState*)zenith::malloc(sizeof(TextEditorState)); TextEditorState* te = (TextEditorState*)montauk::malloc(sizeof(TextEditorState));
zenith::memset(te, 0, sizeof(TextEditorState)); montauk::memset(te, 0, sizeof(TextEditorState));
te->buffer = (char*)zenith::malloc(TE_INIT_CAP); te->buffer = (char*)montauk::malloc(TE_INIT_CAP);
te->buf_cap = TE_INIT_CAP; te->buf_cap = TE_INIT_CAP;
te->buf_len = 0; te->buf_len = 0;
te->modified = false; te->modified = false;
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* app_weather.cpp * app_weather.cpp
* ZenithOS Desktop - Weather app launcher * MontaukOS Desktop - Weather app launcher
* Spawns weather.elf as a standalone Window Server process * Spawns weather.elf as a standalone Window Server process
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -9,5 +9,5 @@
void open_weather(DesktopState* ds) { void open_weather(DesktopState* ds) {
(void)ds; (void)ds;
zenith::spawn("0:/os/weather.elf"); montauk::spawn("0:/os/weather.elf");
} }
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
* app_wiki.cpp * app_wiki.cpp
* ZenithOS Desktop - Wikipedia launcher * MontaukOS Desktop - Wikipedia launcher
* Spawns wikipedia.elf as a standalone Window Server process * Spawns wikipedia.elf as a standalone Window Server process
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -9,5 +9,5 @@
void open_wiki(DesktopState* ds) { void open_wiki(DesktopState* ds) {
(void)ds; (void)ds;
zenith::spawn("0:/os/wikipedia.elf"); montauk::spawn("0:/os/wikipedia.elf");
} }
+4 -4
View File
@@ -6,9 +6,9 @@
#pragma once #pragma once
#include <zenith/syscall.h> #include <montauk/syscall.h>
#include <zenith/string.h> #include <montauk/string.h>
#include <zenith/heap.h> #include <montauk/heap.h>
#include <gui/gui.hpp> #include <gui/gui.hpp>
#include <gui/framebuffer.hpp> #include <gui/framebuffer.hpp>
#include <gui/font.hpp> #include <gui/font.hpp>
@@ -95,7 +95,7 @@ inline int snprintf(char* buf, int size, const char* fmt, ...) {
// ============================================================================ // ============================================================================
inline void str_append(char* dst, const char* src, int max) { inline void str_append(char* dst, const char* src, int max) {
int len = zenith::slen(dst); int len = montauk::slen(dst);
int i = 0; int i = 0;
while (src[i] && len < max - 1) { while (src[i] && len < max - 1) {
dst[len++] = src[i++]; dst[len++] = src[i++];
+81 -81
View File
@@ -1,6 +1,6 @@
/* /*
* main.cpp * main.cpp
* ZenithOS Desktop Environment - window manager, compositor, and run loop * MontaukOS Desktop Environment - window manager, compositor, and run loop
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
@@ -32,8 +32,8 @@ void gui::desktop_init(DesktopState* ds) {
ds->prev_buttons = 0; ds->prev_buttons = 0;
ds->app_menu_open = false; ds->app_menu_open = false;
zenith::memset(&ds->mouse, 0, sizeof(Zenith::MouseState)); montauk::memset(&ds->mouse, 0, sizeof(Montauk::MouseState));
zenith::set_mouse_bounds(ds->screen_w - 1, ds->screen_h - 1); montauk::set_mouse_bounds(ds->screen_w - 1, ds->screen_h - 1);
// Load SVG icons — scalable (colorful) for app menu, symbolic for toolbar/panel // Load SVG icons — scalable (colorful) for app menu, symbolic for toolbar/panel
Color defColor = colors::ICON_COLOR; Color defColor = colors::ICON_COLOR;
@@ -87,17 +87,17 @@ void gui::desktop_init(DesktopState* ds) {
ds->settings.ui_scale = 1; ds->settings.ui_scale = 1;
// Try to load default wallpaper // Try to load default wallpaper
wallpaper_load(&ds->settings, "0:/home/troy-olson-MhYIwOiyZpM-unsplash.jpg", wallpaper_load(&ds->settings, "0:/home/gustav-gullstrand-d6kSvT2xZQo-unsplash.jpg",
ds->screen_w, ds->screen_h); ds->screen_w, ds->screen_h);
zenith::win_setscale(1); montauk::win_setscale(1);
ds->ctx_menu_open = false; ds->ctx_menu_open = false;
ds->ctx_menu_x = 0; ds->ctx_menu_x = 0;
ds->ctx_menu_y = 0; ds->ctx_menu_y = 0;
ds->net_popup_open = false; ds->net_popup_open = false;
zenith::get_netcfg(&ds->cached_net_cfg); montauk::get_netcfg(&ds->cached_net_cfg);
ds->net_cfg_last_poll = zenith::get_milliseconds(); ds->net_cfg_last_poll = montauk::get_milliseconds();
ds->net_icon_rect = {0, 0, 0, 0}; ds->net_icon_rect = {0, 0, 0, 0};
} }
@@ -107,9 +107,9 @@ int gui::desktop_create_window(DesktopState* ds, const char* title, int x, int y
int idx = ds->window_count; int idx = ds->window_count;
Window* win = &ds->windows[idx]; Window* win = &ds->windows[idx];
zenith::memset(win, 0, sizeof(Window)); montauk::memset(win, 0, sizeof(Window));
zenith::strncpy(win->title, title, MAX_TITLE_LEN); montauk::strncpy(win->title, title, MAX_TITLE_LEN);
win->frame = {x, y, w, h}; win->frame = {x, y, w, h};
win->state = WIN_NORMAL; win->state = WIN_NORMAL;
win->z_order = idx; win->z_order = idx;
@@ -124,8 +124,8 @@ int gui::desktop_create_window(DesktopState* ds, const char* title, int x, int y
win->content_w = cr.w; win->content_w = cr.w;
win->content_h = cr.h; win->content_h = cr.h;
int buf_size = cr.w * cr.h * 4; int buf_size = cr.w * cr.h * 4;
win->content = (uint32_t*)zenith::alloc(buf_size); win->content = (uint32_t*)montauk::alloc(buf_size);
zenith::memset(win->content, 0xFF, buf_size); montauk::memset(win->content, 0xFF, buf_size);
win->on_draw = nullptr; win->on_draw = nullptr;
win->on_mouse = nullptr; win->on_mouse = nullptr;
@@ -153,17 +153,17 @@ void gui::desktop_close_window(DesktopState* ds, int idx) {
// For external windows, send a close event instead of freeing the buffer // For external windows, send a close event instead of freeing the buffer
if (win->external) { if (win->external) {
Zenith::WinEvent ev; Montauk::WinEvent ev;
zenith::memset(&ev, 0, sizeof(ev)); montauk::memset(&ev, 0, sizeof(ev));
ev.type = 3; // close ev.type = 3; // close
zenith::win_sendevent(win->ext_win_id, &ev); montauk::win_sendevent(win->ext_win_id, &ev);
} }
if (win->on_close) win->on_close(win); if (win->on_close) win->on_close(win);
// Free content buffer (skip for external windows — shared memory) // Free content buffer (skip for external windows — shared memory)
if (win->content && !win->external) { if (win->content && !win->external) {
zenith::free(win->content); montauk::free(win->content);
win->content = nullptr; win->content = nullptr;
} }
@@ -359,7 +359,7 @@ void gui::desktop_draw_panel(DesktopState* ds) {
// Truncate title if too long // Truncate title if too long
char short_title[20]; char short_title[20];
zenith::strncpy(short_title, win->title, 18); montauk::strncpy(short_title, win->title, 18);
int tx = indicator_x + pad; int tx = indicator_x + pad;
int ty = 4 + (24 - system_font_height()) / 2; int ty = 4 + (24 - system_font_height()) / 2;
@@ -369,8 +369,8 @@ void gui::desktop_draw_panel(DesktopState* ds) {
} }
// Date + Clock (right side) // Date + Clock (right side)
Zenith::DateTime dt; Montauk::DateTime dt;
zenith::gettime(&dt); montauk::gettime(&dt);
char clock_str[12]; char clock_str[12];
if (ds->settings.clock_24h) { if (ds->settings.clock_24h) {
@@ -395,9 +395,9 @@ void gui::desktop_draw_panel(DesktopState* ds) {
draw_text(fb, date_x, clock_y, date_str, colors::PANEL_TEXT); draw_text(fb, date_x, clock_y, date_str, colors::PANEL_TEXT);
// Network icon (to the left of the date) // Network icon (to the left of the date)
uint64_t now = zenith::get_milliseconds(); uint64_t now = montauk::get_milliseconds();
if (now - ds->net_cfg_last_poll > 5000) { if (now - ds->net_cfg_last_poll > 5000) {
zenith::get_netcfg(&ds->cached_net_cfg); montauk::get_netcfg(&ds->cached_net_cfg);
ds->net_cfg_last_poll = now; ds->net_cfg_last_poll = now;
} }
@@ -574,7 +574,7 @@ static void desktop_draw_net_popup(DesktopState* ds) {
int line_h = system_font_height() + 6; int line_h = system_font_height() + 6;
char line[64]; char line[64];
Zenith::NetCfg& nc = ds->cached_net_cfg; Montauk::NetCfg& nc = ds->cached_net_cfg;
if (nc.ipAddress != 0) { if (nc.ipAddress != 0) {
char ipbuf[20]; char ipbuf[20];
@@ -670,7 +670,7 @@ static void reboot_dialog_on_mouse(Window* win, MouseEvent& ev) {
rs->hover_cancel = cb.contains(lx, ly); rs->hover_cancel = cb.contains(lx, ly);
if (ev.left_pressed()) { if (ev.left_pressed()) {
if (rs->hover_reboot) zenith::reset(); if (rs->hover_reboot) montauk::reset();
if (rs->hover_cancel) { if (rs->hover_cancel) {
for (int i = 0; i < rs->ds->window_count; i++) { for (int i = 0; i < rs->ds->window_count; i++) {
if (rs->ds->windows[i].app_data == rs) { if (rs->ds->windows[i].app_data == rs) {
@@ -682,12 +682,12 @@ static void reboot_dialog_on_mouse(Window* win, MouseEvent& ev) {
} }
} }
static void reboot_dialog_on_key(Window* win, const Zenith::KeyEvent& key) { static void reboot_dialog_on_key(Window* win, const Montauk::KeyEvent& key) {
RebootDialogState* rs = (RebootDialogState*)win->app_data; RebootDialogState* rs = (RebootDialogState*)win->app_data;
if (!rs || !key.pressed) return; if (!rs || !key.pressed) return;
if (key.ascii == '\n' || key.ascii == '\r') { if (key.ascii == '\n' || key.ascii == '\r') {
zenith::reset(); montauk::reset();
} }
if (key.scancode == 0x01) { // Escape if (key.scancode == 0x01) { // Escape
for (int i = 0; i < rs->ds->window_count; i++) { for (int i = 0; i < rs->ds->window_count; i++) {
@@ -701,7 +701,7 @@ static void reboot_dialog_on_key(Window* win, const Zenith::KeyEvent& key) {
static void reboot_dialog_on_close(Window* win) { static void reboot_dialog_on_close(Window* win) {
if (win->app_data) { if (win->app_data) {
zenith::mfree(win->app_data); montauk::mfree(win->app_data);
win->app_data = nullptr; win->app_data = nullptr;
} }
} }
@@ -713,8 +713,8 @@ void open_reboot_dialog(DesktopState* ds) {
if (idx < 0) return; if (idx < 0) return;
Window* win = &ds->windows[idx]; Window* win = &ds->windows[idx];
RebootDialogState* rs = (RebootDialogState*)zenith::malloc(sizeof(RebootDialogState)); RebootDialogState* rs = (RebootDialogState*)montauk::malloc(sizeof(RebootDialogState));
zenith::memset(rs, 0, sizeof(RebootDialogState)); montauk::memset(rs, 0, sizeof(RebootDialogState));
rs->ds = ds; rs->ds = ds;
win->app_data = rs; win->app_data = rs;
@@ -782,7 +782,7 @@ static void shutdown_dialog_on_mouse(Window* win, MouseEvent& ev) {
ss->hover_cancel = cb.contains(lx, ly); ss->hover_cancel = cb.contains(lx, ly);
if (ev.left_pressed()) { if (ev.left_pressed()) {
if (ss->hover_shutdown) zenith::shutdown(); if (ss->hover_shutdown) montauk::shutdown();
if (ss->hover_cancel) { if (ss->hover_cancel) {
for (int i = 0; i < ss->ds->window_count; i++) { for (int i = 0; i < ss->ds->window_count; i++) {
if (ss->ds->windows[i].app_data == ss) { if (ss->ds->windows[i].app_data == ss) {
@@ -794,12 +794,12 @@ static void shutdown_dialog_on_mouse(Window* win, MouseEvent& ev) {
} }
} }
static void shutdown_dialog_on_key(Window* win, const Zenith::KeyEvent& key) { static void shutdown_dialog_on_key(Window* win, const Montauk::KeyEvent& key) {
ShutdownDialogState* ss = (ShutdownDialogState*)win->app_data; ShutdownDialogState* ss = (ShutdownDialogState*)win->app_data;
if (!ss || !key.pressed) return; if (!ss || !key.pressed) return;
if (key.ascii == '\n' || key.ascii == '\r') { if (key.ascii == '\n' || key.ascii == '\r') {
zenith::shutdown(); montauk::shutdown();
} }
if (key.scancode == 0x01) { // Escape if (key.scancode == 0x01) { // Escape
for (int i = 0; i < ss->ds->window_count; i++) { for (int i = 0; i < ss->ds->window_count; i++) {
@@ -813,7 +813,7 @@ static void shutdown_dialog_on_key(Window* win, const Zenith::KeyEvent& key) {
static void shutdown_dialog_on_close(Window* win) { static void shutdown_dialog_on_close(Window* win) {
if (win->app_data) { if (win->app_data) {
zenith::mfree(win->app_data); montauk::mfree(win->app_data);
win->app_data = nullptr; win->app_data = nullptr;
} }
} }
@@ -825,8 +825,8 @@ void open_shutdown_dialog(DesktopState* ds) {
if (idx < 0) return; if (idx < 0) return;
Window* win = &ds->windows[idx]; Window* win = &ds->windows[idx];
ShutdownDialogState* ss = (ShutdownDialogState*)zenith::malloc(sizeof(ShutdownDialogState)); ShutdownDialogState* ss = (ShutdownDialogState*)montauk::malloc(sizeof(ShutdownDialogState));
zenith::memset(ss, 0, sizeof(ShutdownDialogState)); montauk::memset(ss, 0, sizeof(ShutdownDialogState));
ss->ds = ds; ss->ds = ds;
win->app_data = ss; win->app_data = ss;
@@ -1100,20 +1100,20 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
if (!win->external) { if (!win->external) {
Rect cr = win->content_rect(); Rect cr = win->content_rect();
if (cr.w != win->content_w || cr.h != win->content_h) { if (cr.w != win->content_w || cr.h != win->content_h) {
if (win->content) zenith::free(win->content); if (win->content) montauk::free(win->content);
win->content_w = cr.w; win->content_w = cr.w;
win->content_h = cr.h; win->content_h = cr.h;
win->content = (uint32_t*)zenith::alloc(cr.w * cr.h * 4); win->content = (uint32_t*)montauk::alloc(cr.w * cr.h * 4);
zenith::memset(win->content, 0xFF, cr.w * cr.h * 4); montauk::memset(win->content, 0xFF, cr.w * cr.h * 4);
} }
} else { } else {
Rect cr = win->content_rect(); Rect cr = win->content_rect();
Zenith::WinEvent rev; Montauk::WinEvent rev;
zenith::memset(&rev, 0, sizeof(rev)); montauk::memset(&rev, 0, sizeof(rev));
rev.type = 2; rev.type = 2;
rev.resize.w = cr.w; rev.resize.w = cr.w;
rev.resize.h = cr.h; rev.resize.h = cr.h;
zenith::win_sendevent(win->ext_win_id, &rev); montauk::win_sendevent(win->ext_win_id, &rev);
} }
} else if (mx >= ds->screen_w - 1) { } else if (mx >= ds->screen_w - 1) {
win->saved_frame = win->frame; win->saved_frame = win->frame;
@@ -1122,20 +1122,20 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
if (!win->external) { if (!win->external) {
Rect cr = win->content_rect(); Rect cr = win->content_rect();
if (cr.w != win->content_w || cr.h != win->content_h) { if (cr.w != win->content_w || cr.h != win->content_h) {
if (win->content) zenith::free(win->content); if (win->content) montauk::free(win->content);
win->content_w = cr.w; win->content_w = cr.w;
win->content_h = cr.h; win->content_h = cr.h;
win->content = (uint32_t*)zenith::alloc(cr.w * cr.h * 4); win->content = (uint32_t*)montauk::alloc(cr.w * cr.h * 4);
zenith::memset(win->content, 0xFF, cr.w * cr.h * 4); montauk::memset(win->content, 0xFF, cr.w * cr.h * 4);
} }
} else { } else {
Rect cr = win->content_rect(); Rect cr = win->content_rect();
Zenith::WinEvent rev; Montauk::WinEvent rev;
zenith::memset(&rev, 0, sizeof(rev)); montauk::memset(&rev, 0, sizeof(rev));
rev.type = 2; rev.type = 2;
rev.resize.w = cr.w; rev.resize.w = cr.w;
rev.resize.h = cr.h; rev.resize.h = cr.h;
zenith::win_sendevent(win->ext_win_id, &rev); montauk::win_sendevent(win->ext_win_id, &rev);
} }
} }
} }
@@ -1188,21 +1188,21 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
if (!win->external) { if (!win->external) {
Rect cr = win->content_rect(); Rect cr = win->content_rect();
if (cr.w != win->content_w || cr.h != win->content_h) { if (cr.w != win->content_w || cr.h != win->content_h) {
if (win->content) zenith::free(win->content); if (win->content) montauk::free(win->content);
win->content_w = cr.w; win->content_w = cr.w;
win->content_h = cr.h; win->content_h = cr.h;
win->content = (uint32_t*)zenith::alloc(cr.w * cr.h * 4); win->content = (uint32_t*)montauk::alloc(cr.w * cr.h * 4);
zenith::memset(win->content, 0xFF, cr.w * cr.h * 4); montauk::memset(win->content, 0xFF, cr.w * cr.h * 4);
} }
win->dirty = true; win->dirty = true;
} else { } else {
Rect cr = win->content_rect(); Rect cr = win->content_rect();
Zenith::WinEvent rev; Montauk::WinEvent rev;
zenith::memset(&rev, 0, sizeof(rev)); montauk::memset(&rev, 0, sizeof(rev));
rev.type = 2; rev.type = 2;
rev.resize.w = cr.w; rev.resize.w = cr.w;
rev.resize.h = cr.h; rev.resize.h = cr.h;
zenith::win_sendevent(win->ext_win_id, &rev); montauk::win_sendevent(win->ext_win_id, &rev);
} }
} }
return; return;
@@ -1355,20 +1355,20 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
if (!win->external) { if (!win->external) {
Rect cr = win->content_rect(); Rect cr = win->content_rect();
if (cr.w != win->content_w || cr.h != win->content_h) { if (cr.w != win->content_w || cr.h != win->content_h) {
if (win->content) zenith::free(win->content); if (win->content) montauk::free(win->content);
win->content_w = cr.w; win->content_w = cr.w;
win->content_h = cr.h; win->content_h = cr.h;
win->content = (uint32_t*)zenith::alloc(cr.w * cr.h * 4); win->content = (uint32_t*)montauk::alloc(cr.w * cr.h * 4);
zenith::memset(win->content, 0xFF, cr.w * cr.h * 4); montauk::memset(win->content, 0xFF, cr.w * cr.h * 4);
} }
} else { } else {
Rect cr = win->content_rect(); Rect cr = win->content_rect();
Zenith::WinEvent rev; Montauk::WinEvent rev;
zenith::memset(&rev, 0, sizeof(rev)); montauk::memset(&rev, 0, sizeof(rev));
rev.type = 2; rev.type = 2;
rev.resize.w = cr.w; rev.resize.w = cr.w;
rev.resize.h = cr.h; rev.resize.h = cr.h;
zenith::win_sendevent(win->ext_win_id, &rev); montauk::win_sendevent(win->ext_win_id, &rev);
} }
desktop_raise_window(ds, i); desktop_raise_window(ds, i);
return; return;
@@ -1416,15 +1416,15 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
Window* raised = &ds->windows[new_idx]; Window* raised = &ds->windows[new_idx];
if (raised->external) { if (raised->external) {
// Forward mouse event to external window // Forward mouse event to external window
Zenith::WinEvent wev; Montauk::WinEvent wev;
zenith::memset(&wev, 0, sizeof(wev)); montauk::memset(&wev, 0, sizeof(wev));
wev.type = 1; // mouse wev.type = 1; // mouse
wev.mouse.x = mx - cr.x; wev.mouse.x = mx - cr.x;
wev.mouse.y = my - cr.y; wev.mouse.y = my - cr.y;
wev.mouse.scroll = ev.scroll; wev.mouse.scroll = ev.scroll;
wev.mouse.buttons = buttons; wev.mouse.buttons = buttons;
wev.mouse.prev_buttons = prev; wev.mouse.prev_buttons = prev;
zenith::win_sendevent(raised->ext_win_id, &wev); montauk::win_sendevent(raised->ext_win_id, &wev);
} else if (raised->on_mouse) { } else if (raised->on_mouse) {
ev.x = mx; ev.x = mx;
ev.y = my; ev.y = my;
@@ -1450,15 +1450,15 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
Rect cr = win->content_rect(); Rect cr = win->content_rect();
if (cr.contains(mx, my)) { if (cr.contains(mx, my)) {
if (win->external) { if (win->external) {
Zenith::WinEvent wev; Montauk::WinEvent wev;
zenith::memset(&wev, 0, sizeof(wev)); montauk::memset(&wev, 0, sizeof(wev));
wev.type = 1; // mouse wev.type = 1; // mouse
wev.mouse.x = mx - cr.x; wev.mouse.x = mx - cr.x;
wev.mouse.y = my - cr.y; wev.mouse.y = my - cr.y;
wev.mouse.scroll = ev.scroll; wev.mouse.scroll = ev.scroll;
wev.mouse.buttons = buttons; wev.mouse.buttons = buttons;
wev.mouse.prev_buttons = prev; wev.mouse.prev_buttons = prev;
zenith::win_sendevent(win->ext_win_id, &wev); montauk::win_sendevent(win->ext_win_id, &wev);
} else if (win->on_mouse) { } else if (win->on_mouse) {
win->on_mouse(win, ev); win->on_mouse(win, ev);
} }
@@ -1486,7 +1486,7 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
} }
} }
void gui::desktop_handle_keyboard(DesktopState* ds, const Zenith::KeyEvent& key) { void gui::desktop_handle_keyboard(DesktopState* ds, const Montauk::KeyEvent& key) {
// Global shortcuts (only on key press) // Global shortcuts (only on key press)
if (key.pressed && key.ctrl && key.alt) { if (key.pressed && key.ctrl && key.alt) {
if (key.ascii == 't' || key.ascii == 'T') { if (key.ascii == 't' || key.ascii == 'T') {
@@ -1524,11 +1524,11 @@ void gui::desktop_handle_keyboard(DesktopState* ds, const Zenith::KeyEvent& key)
Window* win = &ds->windows[ds->focused_window]; Window* win = &ds->windows[ds->focused_window];
if (win->external) { if (win->external) {
// Forward key event to external window via syscall // Forward key event to external window via syscall
Zenith::WinEvent ev; Montauk::WinEvent ev;
zenith::memset(&ev, 0, sizeof(ev)); montauk::memset(&ev, 0, sizeof(ev));
ev.type = 0; // key ev.type = 0; // key
ev.key = key; ev.key = key;
zenith::win_sendevent(win->ext_win_id, &ev); montauk::win_sendevent(win->ext_win_id, &ev);
} else if (win->on_key) { } else if (win->on_key) {
win->on_key(win, key); win->on_key(win, key);
} }
@@ -1540,8 +1540,8 @@ void gui::desktop_handle_keyboard(DesktopState* ds, const Zenith::KeyEvent& key)
// ============================================================================ // ============================================================================
void desktop_poll_external_windows(DesktopState* ds) { void desktop_poll_external_windows(DesktopState* ds) {
Zenith::WinInfo extWins[8]; Montauk::WinInfo extWins[8];
int extCount = zenith::win_enumerate(extWins, 8); int extCount = montauk::win_enumerate(extWins, 8);
// Check for new external windows and map them // Check for new external windows and map them
for (int e = 0; e < extCount; e++) { for (int e = 0; e < extCount; e++) {
@@ -1559,7 +1559,7 @@ void desktop_poll_external_windows(DesktopState* ds) {
// Re-map if external app resized its buffer // Re-map if external app resized its buffer
if (extWins[e].width != ds->windows[i].content_w || if (extWins[e].width != ds->windows[i].content_w ||
extWins[e].height != ds->windows[i].content_h) { extWins[e].height != ds->windows[i].content_h) {
uint64_t va = zenith::win_map(extId); uint64_t va = montauk::win_map(extId);
if (va != 0) { if (va != 0) {
ds->windows[i].content = (uint32_t*)va; ds->windows[i].content = (uint32_t*)va;
ds->windows[i].content_w = extWins[e].width; ds->windows[i].content_w = extWins[e].width;
@@ -1573,14 +1573,14 @@ void desktop_poll_external_windows(DesktopState* ds) {
if (!found && ds->window_count < MAX_WINDOWS) { if (!found && ds->window_count < MAX_WINDOWS) {
// Map the pixel buffer into our address space // Map the pixel buffer into our address space
uint64_t va = zenith::win_map(extId); uint64_t va = montauk::win_map(extId);
if (va == 0) continue; if (va == 0) continue;
int idx = ds->window_count; int idx = ds->window_count;
Window* win = &ds->windows[idx]; Window* win = &ds->windows[idx];
zenith::memset(win, 0, sizeof(Window)); montauk::memset(win, 0, sizeof(Window));
zenith::strncpy(win->title, extWins[e].title, MAX_TITLE_LEN); montauk::strncpy(win->title, extWins[e].title, MAX_TITLE_LEN);
int w = extWins[e].width; int w = extWins[e].width;
int h = extWins[e].height; int h = extWins[e].height;
// Position the window centered-ish // Position the window centered-ish
@@ -1643,12 +1643,12 @@ void gui::desktop_run(DesktopState* ds) {
for (;;) { for (;;) {
// Poll mouse state // Poll mouse state
ds->prev_buttons = ds->mouse.buttons; ds->prev_buttons = ds->mouse.buttons;
zenith::mouse_state(&ds->mouse); montauk::mouse_state(&ds->mouse);
// Poll keyboard events // Poll keyboard events
while (zenith::is_key_available()) { while (montauk::is_key_available()) {
Zenith::KeyEvent key; Montauk::KeyEvent key;
zenith::getkey(&key); montauk::getkey(&key);
desktop_handle_keyboard(ds, key); desktop_handle_keyboard(ds, key);
} }
@@ -1672,7 +1672,7 @@ void gui::desktop_run(DesktopState* ds) {
ds->fb.flip(); ds->fb.flip();
// Target ~60fps // Target ~60fps
zenith::sleep_ms(16); montauk::sleep_ms(16);
} }
} }
@@ -1683,8 +1683,8 @@ void gui::desktop_run(DesktopState* ds) {
static DesktopState* g_desktop; static DesktopState* g_desktop;
extern "C" void _start() { extern "C" void _start() {
DesktopState* ds = (DesktopState*)zenith::malloc(sizeof(DesktopState)); DesktopState* ds = (DesktopState*)montauk::malloc(sizeof(DesktopState));
zenith::memset(ds, 0, sizeof(DesktopState)); montauk::memset(ds, 0, sizeof(DesktopState));
// Placement-new the Framebuffer since it has a constructor // Placement-new the Framebuffer since it has a constructor
new (&ds->fb) Framebuffer(); new (&ds->fb) Framebuffer();
@@ -1694,5 +1694,5 @@ extern "C" void _start() {
desktop_init(ds); desktop_init(ds);
desktop_run(ds); desktop_run(ds);
zenith::exit(0); montauk::exit(0);
} }
+8 -8
View File
@@ -1,13 +1,13 @@
/* /*
* stb_truetype_impl.cpp * stb_truetype_impl.cpp
* Single compilation unit for stb_truetype in ZenithOS freestanding environment * Single compilation unit for stb_truetype in MontaukOS freestanding environment
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
#include <cstdint> #include <cstdint>
#include <cstddef> #include <cstddef>
#include <zenith/heap.h> #include <montauk/heap.h>
#include <zenith/string.h> #include <montauk/string.h>
#include <gui/stb_math.h> #include <gui/stb_math.h>
// Override all stb_truetype dependencies before including the implementation // Override all stb_truetype dependencies before including the implementation
@@ -21,13 +21,13 @@
#define STBTT_acos(x) stb_acos(x) #define STBTT_acos(x) stb_acos(x)
#define STBTT_fabs(x) stb_fabs(x) #define STBTT_fabs(x) stb_fabs(x)
#define STBTT_malloc(x,u) ((void)(u), zenith::malloc(x)) #define STBTT_malloc(x,u) ((void)(u), montauk::malloc(x))
#define STBTT_free(x,u) ((void)(u), zenith::mfree(x)) #define STBTT_free(x,u) ((void)(u), montauk::mfree(x))
#define STBTT_memcpy(d,s,n) zenith::memcpy(d,s,n) #define STBTT_memcpy(d,s,n) montauk::memcpy(d,s,n)
#define STBTT_memset(d,v,n) zenith::memset(d,v,n) #define STBTT_memset(d,v,n) montauk::memset(d,v,n)
#define STBTT_strlen(x) zenith::slen(x) #define STBTT_strlen(x) montauk::slen(x)
#define STBTT_assert(x) ((void)(x)) #define STBTT_assert(x) ((void)(x))
+22 -22
View File
@@ -1,14 +1,14 @@
/* /*
* wallpaper.hpp * wallpaper.hpp
* ZenithOS Desktop - JPEG wallpaper loading, scaling, and directory scanning * MontaukOS Desktop - JPEG wallpaper loading, scaling, and directory scanning
* Copyright (c) 2026 Daniel Hammer * Copyright (c) 2026 Daniel Hammer
*/ */
#pragma once #pragma once
#include <zenith/syscall.h> #include <montauk/syscall.h>
#include <zenith/string.h> #include <montauk/string.h>
#include <zenith/heap.h> #include <montauk/heap.h>
#include <gui/gui.hpp> #include <gui/gui.hpp>
#include <gui/desktop.hpp> #include <gui/desktop.hpp>
@@ -35,41 +35,41 @@ inline bool wallpaper_load(DesktopSettings* s, const char* path,
int screen_w, int screen_h) { int screen_w, int screen_h) {
// Free existing wallpaper // Free existing wallpaper
if (s->bg_wallpaper) { if (s->bg_wallpaper) {
zenith::mfree(s->bg_wallpaper); montauk::mfree(s->bg_wallpaper);
s->bg_wallpaper = nullptr; s->bg_wallpaper = nullptr;
s->bg_wallpaper_w = 0; s->bg_wallpaper_w = 0;
s->bg_wallpaper_h = 0; s->bg_wallpaper_h = 0;
} }
// Read file // Read file
int fd = zenith::open(path); int fd = montauk::open(path);
if (fd < 0) return false; if (fd < 0) return false;
uint64_t size = zenith::getsize(fd); uint64_t size = montauk::getsize(fd);
if (size == 0 || size > 16 * 1024 * 1024) { if (size == 0 || size > 16 * 1024 * 1024) {
zenith::close(fd); montauk::close(fd);
return false; return false;
} }
uint8_t* filedata = (uint8_t*)zenith::malloc(size); uint8_t* filedata = (uint8_t*)montauk::malloc(size);
if (!filedata) { zenith::close(fd); return false; } if (!filedata) { montauk::close(fd); return false; }
int bytes_read = zenith::read(fd, filedata, 0, size); int bytes_read = montauk::read(fd, filedata, 0, size);
zenith::close(fd); montauk::close(fd);
if (bytes_read <= 0) { zenith::mfree(filedata); return false; } if (bytes_read <= 0) { montauk::mfree(filedata); return false; }
// Decode JPEG // Decode JPEG
int img_w, img_h, channels; int img_w, img_h, channels;
unsigned char* rgb = stbi_load_from_memory(filedata, bytes_read, unsigned char* rgb = stbi_load_from_memory(filedata, bytes_read,
&img_w, &img_h, &channels, 3); &img_w, &img_h, &channels, 3);
zenith::mfree(filedata); montauk::mfree(filedata);
if (!rgb) return false; if (!rgb) return false;
// Scale to cover screen (crop to fill, maintain aspect ratio) // Scale to cover screen (crop to fill, maintain aspect ratio)
int dst_w = screen_w; int dst_w = screen_w;
int dst_h = screen_h; int dst_h = screen_h;
uint32_t* scaled = (uint32_t*)zenith::malloc((uint64_t)dst_w * dst_h * 4); uint32_t* scaled = (uint32_t*)montauk::malloc((uint64_t)dst_w * dst_h * 4);
if (!scaled) { stbi_image_free(rgb); return false; } if (!scaled) { stbi_image_free(rgb); return false; }
// Compute source crop region for "cover" scaling // Compute source crop region for "cover" scaling
@@ -110,7 +110,7 @@ inline bool wallpaper_load(DesktopSettings* s, const char* path,
s->bg_wallpaper = scaled; s->bg_wallpaper = scaled;
s->bg_wallpaper_w = dst_w; s->bg_wallpaper_w = dst_w;
s->bg_wallpaper_h = dst_h; s->bg_wallpaper_h = dst_h;
zenith::strncpy(s->bg_image_path, path, 127); montauk::strncpy(s->bg_image_path, path, 127);
s->bg_image = true; s->bg_image = true;
s->bg_gradient = false; s->bg_gradient = false;
@@ -119,7 +119,7 @@ inline bool wallpaper_load(DesktopSettings* s, const char* path,
inline void wallpaper_free(DesktopSettings* s) { inline void wallpaper_free(DesktopSettings* s) {
if (s->bg_wallpaper) { if (s->bg_wallpaper) {
zenith::mfree(s->bg_wallpaper); montauk::mfree(s->bg_wallpaper);
s->bg_wallpaper = nullptr; s->bg_wallpaper = nullptr;
s->bg_wallpaper_w = 0; s->bg_wallpaper_w = 0;
s->bg_wallpaper_h = 0; s->bg_wallpaper_h = 0;
@@ -143,7 +143,7 @@ inline void wallpaper_scan_dir(const char* dir_path, WallpaperFileList* list) {
list->count = 0; list->count = 0;
const char* raw_names[64]; const char* raw_names[64];
int total = zenith::readdir(dir_path, raw_names, 64); int total = montauk::readdir(dir_path, raw_names, 64);
if (total <= 0) return; if (total <= 0) return;
// Compute prefix to strip (readdir returns full paths from VFS root) // Compute prefix to strip (readdir returns full paths from VFS root)
@@ -157,8 +157,8 @@ inline void wallpaper_scan_dir(const char* dir_path, WallpaperFileList* list) {
char prefix[256] = {0}; char prefix[256] = {0};
int prefix_len = 0; int prefix_len = 0;
if (after_drive[0] != '\0') { if (after_drive[0] != '\0') {
zenith::strcpy(prefix, after_drive); montauk::strcpy(prefix, after_drive);
prefix_len = zenith::slen(prefix); prefix_len = montauk::slen(prefix);
if (prefix_len > 0 && prefix[prefix_len - 1] != '/') { if (prefix_len > 0 && prefix[prefix_len - 1] != '/') {
prefix[prefix_len++] = '/'; prefix[prefix_len++] = '/';
prefix[prefix_len] = '\0'; prefix[prefix_len] = '\0';
@@ -181,7 +181,7 @@ inline void wallpaper_scan_dir(const char* dir_path, WallpaperFileList* list) {
if (match) name += prefix_len; if (match) name += prefix_len;
} }
int nlen = zenith::slen(name); int nlen = montauk::slen(name);
// Skip directories // Skip directories
if (nlen > 0 && name[nlen - 1] == '/') continue; if (nlen > 0 && name[nlen - 1] == '/') continue;
@@ -206,7 +206,7 @@ inline void wallpaper_scan_dir(const char* dir_path, WallpaperFileList* list) {
} }
if (is_jpeg) { if (is_jpeg) {
zenith::strncpy(list->names[list->count], name, 63); montauk::strncpy(list->names[list->count], name, 63);
list->count++; list->count++;
} }
} }
+64 -64
View File
@@ -1,15 +1,15 @@
/* /*
* main.cpp * main.cpp
* DHCP client for ZenithOS * DHCP client for MontaukOS
* Obtains network configuration automatically via DHCP (RFC 2131) * Obtains network configuration automatically via DHCP (RFC 2131)
* Copyright (c) 2025-2026 Daniel Hammer * Copyright (c) 2025-2026 Daniel Hammer
*/ */
#include <zenith/syscall.h> #include <montauk/syscall.h>
#include <zenith/string.h> #include <montauk/string.h>
using zenith::memcpy; using montauk::memcpy;
using zenith::memset; using montauk::memset;
// ---- Minimal snprintf (no libc available) ---- // ---- Minimal snprintf (no libc available) ----
@@ -332,62 +332,62 @@ static constexpr uint32_t BROADCAST_IP = 0xFFFFFFFF;
extern "C" void _start() { extern "C" void _start() {
char msg[256]; char msg[256];
zenith::print("ZenithOS DHCP Client\n"); montauk::print("MontaukOS DHCP Client\n");
// 1. Get MAC address // 1. Get MAC address
Zenith::NetCfg origCfg; Montauk::NetCfg origCfg;
zenith::get_netcfg(&origCfg); montauk::get_netcfg(&origCfg);
char macStr[32]; char macStr[32];
format_mac(macStr, sizeof(macStr), origCfg.macAddress); format_mac(macStr, sizeof(macStr), origCfg.macAddress);
snprintf(msg, sizeof(msg), "MAC address: %s\n", macStr); snprintf(msg, sizeof(msg), "MAC address: %s\n", macStr);
zenith::print(msg); montauk::print(msg);
// 2. Set IP to 0.0.0.0 to allow broadcast send/receive // 2. Set IP to 0.0.0.0 to allow broadcast send/receive
Zenith::NetCfg zeroCfg; Montauk::NetCfg zeroCfg;
zeroCfg.ipAddress = 0; zeroCfg.ipAddress = 0;
zeroCfg.subnetMask = 0; zeroCfg.subnetMask = 0;
zeroCfg.gateway = 0; zeroCfg.gateway = 0;
zenith::set_netcfg(&zeroCfg); montauk::set_netcfg(&zeroCfg);
// 3. Create UDP socket and bind to port 68 // 3. Create UDP socket and bind to port 68
int fd = zenith::socket(Zenith::SOCK_UDP); int fd = montauk::socket(Montauk::SOCK_UDP);
if (fd < 0) { if (fd < 0) {
zenith::print("Error: failed to create UDP socket\n"); montauk::print("Error: failed to create UDP socket\n");
zenith::set_netcfg(&origCfg); montauk::set_netcfg(&origCfg);
zenith::exit(1); montauk::exit(1);
} }
if (zenith::bind(fd, DHCP_CLIENT_PORT) < 0) { if (montauk::bind(fd, DHCP_CLIENT_PORT) < 0) {
zenith::print("Error: failed to bind to port 68\n"); montauk::print("Error: failed to bind to port 68\n");
zenith::closesocket(fd); montauk::closesocket(fd);
zenith::set_netcfg(&origCfg); montauk::set_netcfg(&origCfg);
zenith::exit(1); montauk::exit(1);
} }
// 4. Send DISCOVER // 4. Send DISCOVER
DhcpPacket pkt; DhcpPacket pkt;
int pktLen = build_discover(&pkt, origCfg.macAddress); int pktLen = build_discover(&pkt, origCfg.macAddress);
zenith::print("Sending DHCPDISCOVER...\n"); montauk::print("Sending DHCPDISCOVER...\n");
if (zenith::sendto(fd, (const void*)&pkt, pktLen, BROADCAST_IP, DHCP_SERVER_PORT) < 0) { if (montauk::sendto(fd, (const void*)&pkt, pktLen, BROADCAST_IP, DHCP_SERVER_PORT) < 0) {
zenith::print("Error: failed to send DISCOVER\n"); montauk::print("Error: failed to send DISCOVER\n");
zenith::closesocket(fd); montauk::closesocket(fd);
zenith::set_netcfg(&origCfg); montauk::set_netcfg(&origCfg);
zenith::exit(1); montauk::exit(1);
} }
// 5. Wait for OFFER // 5. Wait for OFFER
DhcpPacket resp; DhcpPacket resp;
DhcpOffer offer; DhcpOffer offer;
uint64_t startMs = zenith::get_milliseconds(); uint64_t startMs = montauk::get_milliseconds();
bool gotOffer = false; bool gotOffer = false;
zenith::print("Waiting for DHCPOFFER...\n"); montauk::print("Waiting for DHCPOFFER...\n");
while (zenith::get_milliseconds() - startMs < 10000) { while (montauk::get_milliseconds() - startMs < 10000) {
uint32_t srcIp; uint32_t srcIp;
uint16_t srcPort; uint16_t srcPort;
int r = zenith::recvfrom(fd, (void*)&resp, sizeof(resp), &srcIp, &srcPort); int r = montauk::recvfrom(fd, (void*)&resp, sizeof(resp), &srcIp, &srcPort);
if (r > 0) { if (r > 0) {
if (resp.op == BOOTREPLY && resp.xid == g_xid) { if (resp.op == BOOTREPLY && resp.xid == g_xid) {
parse_options(&resp, &offer); parse_options(&resp, &offer);
@@ -397,41 +397,41 @@ extern "C" void _start() {
} }
} }
} }
zenith::yield(); montauk::yield();
} }
if (!gotOffer) { if (!gotOffer) {
zenith::print("Error: no DHCPOFFER received (timeout)\n"); montauk::print("Error: no DHCPOFFER received (timeout)\n");
zenith::closesocket(fd); montauk::closesocket(fd);
zenith::set_netcfg(&origCfg); montauk::set_netcfg(&origCfg);
zenith::exit(1); montauk::exit(1);
} }
char ipStr[32]; char ipStr[32];
format_ip(ipStr, sizeof(ipStr), offer.offeredIp); format_ip(ipStr, sizeof(ipStr), offer.offeredIp);
snprintf(msg, sizeof(msg), "Received OFFER: %s\n", ipStr); snprintf(msg, sizeof(msg), "Received OFFER: %s\n", ipStr);
zenith::print(msg); montauk::print(msg);
// 6. Send REQUEST // 6. Send REQUEST
pktLen = build_request(&pkt, origCfg.macAddress, offer.offeredIp, offer.serverId); pktLen = build_request(&pkt, origCfg.macAddress, offer.offeredIp, offer.serverId);
zenith::print("Sending DHCPREQUEST...\n"); montauk::print("Sending DHCPREQUEST...\n");
if (zenith::sendto(fd, (const void*)&pkt, pktLen, BROADCAST_IP, DHCP_SERVER_PORT) < 0) { if (montauk::sendto(fd, (const void*)&pkt, pktLen, BROADCAST_IP, DHCP_SERVER_PORT) < 0) {
zenith::print("Error: failed to send REQUEST\n"); montauk::print("Error: failed to send REQUEST\n");
zenith::closesocket(fd); montauk::closesocket(fd);
zenith::set_netcfg(&origCfg); montauk::set_netcfg(&origCfg);
zenith::exit(1); montauk::exit(1);
} }
// 7. Wait for ACK // 7. Wait for ACK
bool gotAck = false; bool gotAck = false;
startMs = zenith::get_milliseconds(); startMs = montauk::get_milliseconds();
zenith::print("Waiting for DHCPACK...\n"); montauk::print("Waiting for DHCPACK...\n");
while (zenith::get_milliseconds() - startMs < 10000) { while (montauk::get_milliseconds() - startMs < 10000) {
uint32_t srcIp; uint32_t srcIp;
uint16_t srcPort; uint16_t srcPort;
int r = zenith::recvfrom(fd, (void*)&resp, sizeof(resp), &srcIp, &srcPort); int r = montauk::recvfrom(fd, (void*)&resp, sizeof(resp), &srcIp, &srcPort);
if (r > 0) { if (r > 0) {
if (resp.op == BOOTREPLY && resp.xid == g_xid) { if (resp.op == BOOTREPLY && resp.xid == g_xid) {
parse_options(&resp, &offer); parse_options(&resp, &offer);
@@ -440,57 +440,57 @@ extern "C" void _start() {
break; break;
} }
if (offer.valid && offer.msgType == DHCPNAK) { if (offer.valid && offer.msgType == DHCPNAK) {
zenith::print("Error: received DHCPNAK from server\n"); montauk::print("Error: received DHCPNAK from server\n");
zenith::closesocket(fd); montauk::closesocket(fd);
zenith::set_netcfg(&origCfg); montauk::set_netcfg(&origCfg);
zenith::exit(1); montauk::exit(1);
} }
} }
} }
zenith::yield(); montauk::yield();
} }
zenith::closesocket(fd); montauk::closesocket(fd);
if (!gotAck) { if (!gotAck) {
zenith::print("Error: no DHCPACK received (timeout)\n"); montauk::print("Error: no DHCPACK received (timeout)\n");
zenith::set_netcfg(&origCfg); montauk::set_netcfg(&origCfg);
zenith::exit(1); montauk::exit(1);
} }
// 8. Apply configuration // 8. Apply configuration
Zenith::NetCfg newCfg; Montauk::NetCfg newCfg;
newCfg.ipAddress = offer.offeredIp; newCfg.ipAddress = offer.offeredIp;
newCfg.subnetMask = offer.subnetMask; newCfg.subnetMask = offer.subnetMask;
newCfg.gateway = offer.router; newCfg.gateway = offer.router;
newCfg.dnsServer = offer.dns; newCfg.dnsServer = offer.dns;
zenith::set_netcfg(&newCfg); montauk::set_netcfg(&newCfg);
// 9. Print results // 9. Print results
zenith::print("\nDHCP configuration applied:\n"); montauk::print("\nDHCP configuration applied:\n");
format_ip(ipStr, sizeof(ipStr), offer.offeredIp); format_ip(ipStr, sizeof(ipStr), offer.offeredIp);
snprintf(msg, sizeof(msg), " IP Address: %s\n", ipStr); snprintf(msg, sizeof(msg), " IP Address: %s\n", ipStr);
zenith::print(msg); montauk::print(msg);
format_ip(ipStr, sizeof(ipStr), offer.subnetMask); format_ip(ipStr, sizeof(ipStr), offer.subnetMask);
snprintf(msg, sizeof(msg), " Subnet Mask: %s\n", ipStr); snprintf(msg, sizeof(msg), " Subnet Mask: %s\n", ipStr);
zenith::print(msg); montauk::print(msg);
format_ip(ipStr, sizeof(ipStr), offer.router); format_ip(ipStr, sizeof(ipStr), offer.router);
snprintf(msg, sizeof(msg), " Gateway: %s\n", ipStr); snprintf(msg, sizeof(msg), " Gateway: %s\n", ipStr);
zenith::print(msg); montauk::print(msg);
if (offer.dns != 0) { if (offer.dns != 0) {
format_ip(ipStr, sizeof(ipStr), offer.dns); format_ip(ipStr, sizeof(ipStr), offer.dns);
snprintf(msg, sizeof(msg), " DNS Server: %s\n", ipStr); snprintf(msg, sizeof(msg), " DNS Server: %s\n", ipStr);
zenith::print(msg); montauk::print(msg);
} }
if (offer.leaseTime != 0) { if (offer.leaseTime != 0) {
snprintf(msg, sizeof(msg), " Lease Time: %u seconds\n", offer.leaseTime); snprintf(msg, sizeof(msg), " Lease Time: %u seconds\n", offer.leaseTime);
zenith::print(msg); montauk::print(msg);
} }
zenith::exit(0); montauk::exit(0);
} }
+2 -2
View File
@@ -1,4 +1,4 @@
# Makefile for DOOM (doomgeneric) on ZenithOS # Makefile for DOOM (doomgeneric) on MontaukOS
# Copyright (c) 2025 Daniel Hammer # Copyright (c) 2025 Daniel Hammer
MAKEFLAGS += -rR MAKEFLAGS += -rR
@@ -153,7 +153,7 @@ DOOM_SRCS := \
z_zone.c z_zone.c
# Local source files # Local source files
LOCAL_SRCS := doomgeneric_zenith.c libc.c LOCAL_SRCS := doomgeneric_montauk.c libc.c
# ---- Object files ---- # ---- Object files ----
@@ -1,6 +1,6 @@
/* /*
* doomgeneric_zenith.c * doomgeneric_montauk.c
* DOOM platform implementation for ZenithOS (standalone window server client) * DOOM platform implementation for MontaukOS (standalone window server client)
* Copyright (c) 2025 Daniel Hammer * Copyright (c) 2025 Daniel Hammer
*/ */
@@ -66,7 +66,7 @@ static inline long _zos_syscall4(long nr, long a1, long a2, long a3, long a4) {
#define SYS_WINPRESENT 56 #define SYS_WINPRESENT 56
#define SYS_WINPOLL 57 #define SYS_WINPOLL 57
/* Window server structs (must match Zenith::WinCreateResult and Zenith::WinEvent) */ /* Window server structs (must match Montauk::WinCreateResult and Montauk::WinEvent) */
struct WinCreateResult { struct WinCreateResult {
int id; /* -1 on failure */ int id; /* -1 on failure */
unsigned _pad; unsigned _pad;

Some files were not shown because too many files have changed in this diff Show More