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
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* Syscall.hpp
* ZenithOS syscall definitions for userspace programs
* MontaukOS syscall definitions for userspace programs
* Copyright (c) 2025 Daniel Hammer
*/
@@ -8,7 +8,7 @@
#include <cstdint>
#include <cstddef>
namespace Zenith {
namespace Montauk {
// Syscall numbers
static constexpr uint64_t SYS_EXIT = 0;
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* 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.
* Copyright (c) 2026 Daniel Hammer
*/
+4 -4
View File
@@ -1,6 +1,6 @@
/*
* desktop.hpp
* ZenithOS desktop state and compositor declarations
* MontaukOS desktop state and compositor declarations
* Copyright (c) 2026 Daniel Hammer
*/
@@ -50,7 +50,7 @@ struct DesktopState {
int window_count;
int focused_window;
Zenith::MouseState mouse;
Montauk::MouseState mouse;
uint8_t prev_buttons;
bool app_menu_open;
@@ -92,7 +92,7 @@ struct DesktopState {
int ctx_menu_x, ctx_menu_y;
bool net_popup_open;
Zenith::NetCfg cached_net_cfg;
Montauk::NetCfg cached_net_cfg;
uint64_t net_cfg_last_poll;
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_window(DesktopState* ds, int idx);
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
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* draw.hpp
* ZenithOS drawing primitives (lines, circles, rounded rects, cursor)
* MontaukOS drawing primitives (lines, circles, rounded rects, cursor)
* Copyright (c) 2025 Daniel Hammer
*/
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* font.hpp
* ZenithOS text rendering — TrueType with bitmap fallback
* MontaukOS text rendering — TrueType with bitmap fallback
* Copyright (c) 2025 Daniel Hammer
*/
+6 -6
View File
@@ -1,12 +1,12 @@
/*
* framebuffer.hpp
* ZenithOS double-buffered framebuffer abstraction
* MontaukOS double-buffered framebuffer abstraction
* Copyright (c) 2025 Daniel Hammer
*/
#pragma once
#include <cstdint>
#include <zenith/syscall.h>
#include <montauk/syscall.h>
#include "gui/gui.hpp"
namespace gui {
@@ -20,15 +20,15 @@ class Framebuffer {
public:
Framebuffer() : hw_fb(nullptr), back_buf(nullptr), fb_width(0), fb_height(0), fb_pitch(0) {
Zenith::FbInfo info;
zenith::fb_info(&info);
Montauk::FbInfo info;
montauk::fb_info(&info);
fb_width = (int)info.width;
fb_height = (int)info.height;
fb_pitch = (int)info.pitch;
hw_fb = (uint32_t*)zenith::fb_map();
back_buf = (uint32_t*)zenith::alloc((uint64_t)fb_height * fb_pitch);
hw_fb = (uint32_t*)montauk::fb_map();
back_buf = (uint32_t*)montauk::alloc((uint64_t)fb_height * fb_pitch);
}
int width() const { return fb_width; }
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* gui.hpp
* ZenithOS core GUI types and utilities
* MontaukOS core GUI types and utilities
* Copyright (c) 2025 Daniel Hammer
*/
+19 -19
View File
@@ -1,6 +1,6 @@
/*
* 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)
* All math uses 16.16 fixed-point -- NO floating point.
* Copyright (c) 2025 Daniel Hammer
@@ -8,7 +8,7 @@
#pragma once
#include "gui/gui.hpp"
#include <zenith/syscall.h>
#include <montauk/syscall.h>
namespace gui {
@@ -321,7 +321,7 @@ struct SvgEdgeList {
int capacity;
void init(int cap) {
edges = (SvgEdge*)zenith::alloc(cap * sizeof(SvgEdge));
edges = (SvgEdge*)montauk::alloc(cap * sizeof(SvgEdge));
count = 0;
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
// Allocate enough for all edges (each edge can intersect at most once per scanline)
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) {
// 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;
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 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;
icon.width = target_w;
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
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;
}
zenith::free(el.edges);
montauk::free(el.edges);
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
// ---------------------------------------------------------------------------
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) {
return {nullptr, 0, 0};
}
uint64_t size = zenith::getsize(fd);
uint64_t size = montauk::getsize(fd);
if (size == 0 || size > SVG_MAX_FILE_SIZE) {
zenith::close(fd);
montauk::close(fd);
return {nullptr, 0, 0};
}
char* buf = (char*)zenith::alloc(size + 1);
zenith::read(fd, (uint8_t*)buf, 0, size);
zenith::close(fd);
char* buf = (char*)montauk::alloc(size + 1);
montauk::read(fd, (uint8_t*)buf, 0, size);
montauk::close(fd);
buf[size] = '\0';
// 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;
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};
// 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;
// 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};
}
@@ -1440,7 +1440,7 @@ inline SvgIcon svg_load(const char* vfs_path, int target_w, int target_h, Color
// Free icon pixel data
// ---------------------------------------------------------------------------
inline void svg_free(SvgIcon& icon) {
if (icon.pixels) zenith::free(icon.pixels);
if (icon.pixels) montauk::free(icon.pixels);
icon.pixels = nullptr;
icon.width = 0;
icon.height = 0;
+15 -15
View File
@@ -1,14 +1,14 @@
/*
* terminal.hpp
* ZenithOS terminal emulator with ANSI escape sequence support
* MontaukOS terminal emulator with ANSI escape sequence support
* Copyright (c) 2026 Daniel Hammer
*/
#pragma once
#include "gui/gui.hpp"
#include "gui/font.hpp"
#include <zenith/syscall.h>
#include <zenith/string.h>
#include <montauk/syscall.h>
#include <montauk/string.h>
#include <Api/Syscall.hpp>
namespace gui {
@@ -102,8 +102,8 @@ static inline void terminal_init_cells(TerminalState* t, int cols, int rows) {
t->child_pid = 0;
int total_cells = cols * rows;
t->cells = (TermCell*)zenith::alloc(total_cells * sizeof(TermCell));
t->alt_cells = (TermCell*)zenith::alloc(total_cells * sizeof(TermCell));
t->cells = (TermCell*)montauk::alloc(total_cells * sizeof(TermCell));
t->alt_cells = (TermCell*)montauk::alloc(total_cells * sizeof(TermCell));
for (int i = 0; i < total_cells; i++) {
t->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);
t->cursor_visible = true;
t->child_pid = zenith::spawn_redir("0:/os/shell.elf");
zenith::childio_settermsz(t->child_pid, cols, rows);
t->child_pid = montauk::spawn_redir("0:/os/shell.elf");
montauk::childio_settermsz(t->child_pid, cols, rows);
}
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;
int new_total = new_cols * new_rows;
TermCell* new_cells = (TermCell*)zenith::alloc(new_total * sizeof(TermCell));
TermCell* new_alt = (TermCell*)zenith::alloc(new_total * sizeof(TermCell));
TermCell* new_cells = (TermCell*)montauk::alloc(new_total * sizeof(TermCell));
TermCell* new_alt = (TermCell*)montauk::alloc(new_total * sizeof(TermCell));
// Clear new buffers
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->alt_cells) zenith::mfree(t->alt_cells);
if (t->cells) montauk::mfree(t->cells);
if (t->alt_cells) montauk::mfree(t->alt_cells);
t->cells = new_cells;
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
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) {
zenith::childio_writekey(t->child_pid, &key);
montauk::childio_writekey(t->child_pid, &key);
}
}
static inline void terminal_poll(TerminalState* t) {
if (t->child_pid <= 0) return;
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) {
terminal_feed(t, buf, n);
}
+21 -21
View File
@@ -1,14 +1,14 @@
/*
* truetype.hpp
* ZenithOS TrueType font rendering via stb_truetype
* MontaukOS TrueType font rendering via stb_truetype
* Copyright (c) 2026 Daniel Hammer
*/
#pragma once
#include <cstdint>
#include <zenith/syscall.h>
#include <zenith/heap.h>
#include <zenith/string.h>
#include <montauk/syscall.h>
#include <montauk/heap.h>
#include <montauk/string.h>
#include "gui/gui.hpp"
#include "gui/framebuffer.hpp"
@@ -29,11 +29,11 @@
#define STBTT_cos(x) stb_cos(x)
#define STBTT_acos(x) stb_acos(x)
#define STBTT_fabs(x) stb_fabs(x)
#define STBTT_malloc(x,u) ((void)(u), zenith::malloc(x))
#define STBTT_free(x,u) ((void)(u), zenith::mfree(x))
#define STBTT_memcpy(d,s,n) zenith::memcpy(d,s,n)
#define STBTT_memset(d,v,n) zenith::memset(d,v,n)
#define STBTT_strlen(x) zenith::slen(x)
#define STBTT_malloc(x,u) ((void)(u), montauk::malloc(x))
#define STBTT_free(x,u) ((void)(u), montauk::mfree(x))
#define STBTT_memcpy(d,s,n) montauk::memcpy(d,s,n)
#define STBTT_memset(d,v,n) montauk::memset(d,v,n)
#define STBTT_strlen(x) montauk::slen(x)
#define STBTT_assert(x) ((void)(x))
#endif
@@ -69,26 +69,26 @@ struct TrueTypeFont {
data = nullptr;
cache_count = 0;
int fd = zenith::open(vfs_path);
int fd = montauk::open(vfs_path);
if (fd < 0) return false;
uint64_t size = zenith::getsize(fd);
uint64_t size = montauk::getsize(fd);
if (size == 0 || size > 1024 * 1024) {
zenith::close(fd);
montauk::close(fd);
return false;
}
data = (uint8_t*)zenith::alloc(size);
data = (uint8_t*)montauk::alloc(size);
if (!data) {
zenith::close(fd);
montauk::close(fd);
return false;
}
zenith::read(fd, data, 0, size);
zenith::close(fd);
montauk::read(fd, data, 0, size);
montauk::close(fd);
if (!stbtt_InitFont(&info, data, stbtt_GetFontOffsetForIndex(data, 0))) {
zenith::free(data);
montauk::free(data);
data = nullptr;
return false;
}
@@ -145,7 +145,7 @@ struct TrueTypeFont {
g->yoff = y0;
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,
g->width, gc->scale, gc->scale, codepoint);
}
@@ -314,10 +314,10 @@ namespace fonts {
inline bool init() {
auto load = [](const char* path) -> TrueTypeFont* {
TrueTypeFont* f = (TrueTypeFont*)zenith::malloc(sizeof(TrueTypeFont));
zenith::memset(f, 0, sizeof(TrueTypeFont));
TrueTypeFont* f = (TrueTypeFont*)montauk::malloc(sizeof(TrueTypeFont));
montauk::memset(f, 0, sizeof(TrueTypeFont));
if (!f->init(path)) {
zenith::mfree(f);
montauk::mfree(f);
return nullptr;
}
return f;
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* widgets.hpp
* ZenithOS GUI widget toolkit (Label, Button, TextBox, Scrollbar)
* MontaukOS GUI widget toolkit (Label, Button, TextBox, Scrollbar)
* 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 (key.ascii == '\b' || key.scancode == 0x0E) {
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* window.hpp
* ZenithOS window management types
* MontaukOS window management types
* Copyright (c) 2026 Daniel Hammer
*/
@@ -32,7 +32,7 @@ static constexpr int MIN_WINDOW_H = 80;
struct Window;
using WindowDrawCallback = void (*)(Window* win, Framebuffer& fb);
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 WindowPollCallback = void (*)(Window* win);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef _LIBC_SYS_TIME_H
#define _LIBC_SYS_TIME_H
/* Stub header for ZenithOS */
/* Stub header for MontaukOS */
#ifdef __cplusplus
extern "C" {
@@ -1,15 +1,15 @@
/*
* heap.h
* Userspace heap allocator for ZenithOS programs
* Userspace heap allocator for MontaukOS programs
* Free-list allocator backed by SYS_ALLOC page requests.
* Adapted from the kernel HeapAllocator.
* Copyright (c) 2025 Daniel Hammer
*/
#pragma once
#include <zenith/syscall.h>
#include <montauk/syscall.h>
namespace zenith {
namespace montauk {
namespace heap_detail {
static constexpr uint64_t HEADER_MAGIC = 0x5A484541; // "ZHEA"
@@ -43,7 +43,7 @@ namespace heap_detail {
uint64_t pages = (bytes + 0xFFF) / 0x1000;
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;
insert_free(mem, pages * 0x1000);
return true;
@@ -132,4 +132,4 @@ namespace heap_detail {
return newBlock;
}
} // namespace zenith
} // namespace montauk
@@ -1,13 +1,13 @@
/*
* 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
*/
#pragma once
#include <cstdint>
namespace zenith {
namespace montauk {
inline int slen(const char* s) {
int n = 0;
@@ -1,13 +1,13 @@
/*
* syscall.h
* ZenithOS program-side syscall wrappers using SYSCALL instruction
* MontaukOS program-side syscall wrappers using SYSCALL instruction
* Copyright (c) 2025 Daniel Hammer
*/
#pragma once
#include <Api/Syscall.hpp>
namespace zenith {
namespace montauk {
// ---- Raw SYSCALL wrappers ----
@@ -110,224 +110,224 @@ namespace zenith {
// Process
[[noreturn]] inline void exit(int code = 0) {
syscall1(Zenith::SYS_EXIT, (uint64_t)code);
syscall1(Montauk::SYS_EXIT, (uint64_t)code);
__builtin_unreachable();
}
inline void yield() { syscall0(Zenith::SYS_YIELD); }
inline void sleep_ms(uint64_t ms) { syscall1(Zenith::SYS_SLEEP_MS, ms); }
inline int getpid() { return (int)syscall0(Zenith::SYS_GETPID); }
inline void yield() { syscall0(Montauk::SYS_YIELD); }
inline void sleep_ms(uint64_t ms) { syscall1(Montauk::SYS_SLEEP_MS, ms); }
inline int getpid() { return (int)syscall0(Montauk::SYS_GETPID); }
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
inline void print(const char* text) { syscall1(Zenith::SYS_PRINT, (uint64_t)text); }
inline void putchar(char c) { syscall1(Zenith::SYS_PUTCHAR, (uint64_t)c); }
inline void print(const char* text) { syscall1(Montauk::SYS_PRINT, (uint64_t)text); }
inline void putchar(char c) { syscall1(Montauk::SYS_PUTCHAR, (uint64_t)c); }
// 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) {
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 void close(int handle) { syscall1(Zenith::SYS_CLOSE, (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(Montauk::SYS_CLOSE, (uint64_t)handle); }
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
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) {
return (int)syscall1(Zenith::SYS_FCREATE, (uint64_t)path);
return (int)syscall1(Montauk::SYS_FCREATE, (uint64_t)path);
}
// Memory
inline void* alloc(uint64_t size) { return (void*)syscall1(Zenith::SYS_ALLOC, size); }
inline void free(void* ptr) { syscall1(Zenith::SYS_FREE, (uint64_t)ptr); }
inline void* alloc(uint64_t size) { return (void*)syscall1(Montauk::SYS_ALLOC, size); }
inline void free(void* ptr) { syscall1(Montauk::SYS_FREE, (uint64_t)ptr); }
// Timekeeping
inline uint64_t get_ticks() { return (uint64_t)syscall0(Zenith::SYS_GETTICKS); }
inline uint64_t get_milliseconds() { return (uint64_t)syscall0(Zenith::SYS_GETMILLISECONDS); }
inline uint64_t get_ticks() { return (uint64_t)syscall0(Montauk::SYS_GETTICKS); }
inline uint64_t get_milliseconds() { return (uint64_t)syscall0(Montauk::SYS_GETMILLISECONDS); }
// 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
inline bool is_key_available() { return (bool)syscall0(Zenith::SYS_ISKEYAVAILABLE); }
inline void getkey(Zenith::KeyEvent* out) { syscall1(Zenith::SYS_GETKEY, (uint64_t)out); }
inline char getchar() { return (char)syscall0(Zenith::SYS_GETCHAR); }
inline bool is_key_available() { return (bool)syscall0(Montauk::SYS_ISKEYAVAILABLE); }
inline void getkey(Montauk::KeyEvent* out) { syscall1(Montauk::SYS_GETKEY, (uint64_t)out); }
inline char getchar() { return (char)syscall0(Montauk::SYS_GETCHAR); }
// Networking
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
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
inline void get_netcfg(Zenith::NetCfg* out) { syscall1(Zenith::SYS_GETNETCFG, (uint64_t)out); }
inline int set_netcfg(const Zenith::NetCfg* cfg) { return (int)syscall1(Zenith::SYS_SETNETCFG, (uint64_t)cfg); }
inline void get_netcfg(Montauk::NetCfg* out) { syscall1(Montauk::SYS_GETNETCFG, (uint64_t)out); }
inline int set_netcfg(const Montauk::NetCfg* cfg) { return (int)syscall1(Montauk::SYS_SETNETCFG, (uint64_t)cfg); }
// Sockets
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) {
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) {
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) {
return (int)syscall1(Zenith::SYS_LISTEN, (uint64_t)fd);
return (int)syscall1(Montauk::SYS_LISTEN, (uint64_t)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) {
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) {
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) {
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) {
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);
}
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);
}
// 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
inline void fb_info(Zenith::FbInfo* info) { syscall1(Zenith::SYS_FBINFO, (uint64_t)info); }
inline void* fb_map() { return (void*)syscall0(Zenith::SYS_FBMAP); }
inline void fb_info(Montauk::FbInfo* info) { syscall1(Montauk::SYS_FBINFO, (uint64_t)info); }
inline void* fb_map() { return (void*)syscall0(Montauk::SYS_FBMAP); }
// Arguments
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
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 (rows) *rows = (int)(r >> 32);
}
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) {
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_y) *scale_y = (int)(r >> 32);
}
// 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
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
[[noreturn]] inline void reset() {
syscall0(Zenith::SYS_RESET);
syscall0(Montauk::SYS_RESET);
__builtin_unreachable();
}
[[noreturn]] inline void shutdown() {
syscall0(Zenith::SYS_SHUTDOWN);
syscall0(Montauk::SYS_SHUTDOWN);
__builtin_unreachable();
}
// 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) {
syscall2(Zenith::SYS_SETMOUSEBOUNDS, (uint64_t)maxX, (uint64_t)maxY);
syscall2(Montauk::SYS_SETMOUSEBOUNDS, (uint64_t)maxX, (uint64_t)maxY);
}
// Kernel log
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
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) {
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) {
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) {
return (int)syscall2(Zenith::SYS_CHILDIO_WRITEKEY, (uint64_t)childPid, (uint64_t)key);
inline int childio_writekey(int childPid, const Montauk::KeyEvent* key) {
return (int)syscall2(Montauk::SYS_CHILDIO_WRITEKEY, (uint64_t)childPid, (uint64_t)key);
}
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
inline int proclist(Zenith::ProcInfo* buf, int max) {
return (int)syscall2(Zenith::SYS_PROCLIST, (uint64_t)buf, (uint64_t)max);
inline int proclist(Montauk::ProcInfo* buf, int max) {
return (int)syscall2(Montauk::SYS_PROCLIST, (uint64_t)buf, (uint64_t)max);
}
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) {
return (int)syscall2(Zenith::SYS_DEVLIST, (uint64_t)buf, (uint64_t)max);
inline int devlist(Montauk::DevInfo* buf, int max) {
return (int)syscall2(Montauk::SYS_DEVLIST, (uint64_t)buf, (uint64_t)max);
}
// 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
inline int win_create(const char* title, int w, int h, Zenith::WinCreateResult* result) {
return (int)syscall4(Zenith::SYS_WINCREATE, (uint64_t)title, (uint64_t)w, (uint64_t)h, (uint64_t)result);
inline int win_create(const char* title, int w, int h, Montauk::WinCreateResult* 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) {
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) {
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) {
return (int)syscall2(Zenith::SYS_WINPOLL, (uint64_t)id, (uint64_t)event);
inline int win_poll(int id, Montauk::WinEvent* event) {
return (int)syscall2(Montauk::SYS_WINPOLL, (uint64_t)id, (uint64_t)event);
}
inline int win_enumerate(Zenith::WinInfo* info, int max) {
return (int)syscall2(Zenith::SYS_WINENUM, (uint64_t)info, (uint64_t)max);
inline int win_enumerate(Montauk::WinInfo* info, int max) {
return (int)syscall2(Montauk::SYS_WINENUM, (uint64_t)info, (uint64_t)max);
}
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) {
return (int)syscall2(Zenith::SYS_WINSENDEVENT, (uint64_t)id, (uint64_t)event);
inline int win_sendevent(int id, const Montauk::WinEvent* event) {
return (int)syscall2(Montauk::SYS_WINSENDEVENT, (uint64_t)id, (uint64_t)event);
}
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) {
return (int)syscall1(Zenith::SYS_WINSETSCALE, (uint64_t)scale);
return (int)syscall1(Montauk::SYS_WINSETSCALE, (uint64_t)scale);
}
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
* Shared TLS helper library for ZenithOS
* Shared TLS helper library for MontaukOS
* Trust anchor loading, BearSSL time, TLS I/O, HTTPS fetch
* Copyright (c) 2026 Daniel Hammer
*/