Compare commits

..
12 Commits
Author SHA1 Message Date
Aaron ee7dcd107b feat(filebrowser): add delete button to toolbar, fix FAT32 delete/rename with raw sector scanning
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
- Add SYM_TRASH toolbar button wired to fb_delete_cb (was missing entirely)
- Filter '.' and '..' entries in fb_collect_cb so they never appear
- Rewrite deleteFile/deleteDir/renameFile to use raw sector scanning
  instead of getDirEntries linked-list indices (fixes  gap mismatch)
- Handle root directory correctly (use bootRecord^.rootCluster instead
  of assuming entry 0 is '.')
2026-03-11 19:41:51 +00:00
Aaron 671c144ad5 fix: FAT32 >1024 byte read/write truncation, VFS write notifications & dir watch
- FAT32 writeFile: replace hardcoded spc=4 with bootRecord^.spc for
  cluster allocation and per-sector write loop
- FAT32 writeFile: update directory entry byteSize on disk after write
- FAT32 readFile: use dir^.byteSize instead of cluster-based estimate,
  fix off-by-one in read loop, remove spurious +sectorSize allocation
- VFS: fire VFS_OnMutation on sync/async writes (cache invalidate + watch)
- VFS: invalidate all cache entries for volume on mutation (relPath mismatch)
- VFS: add vfsParentDir helper, store VFSDir in file descriptors
- FDTable: add VFSDir field, free on close
- File browser: enable directory watch & poll timer, two-step new file
  creation (open + write), remove io.syslog import
- Linker: add --no-warn-execstack to suppress ld exit code 1 on warning
- Add core.strings.helpers unit (getFileExtension, fmtFileSize, sort)
2026-03-11 19:41:51 +00:00
Aaron 8755f108f2 refactor: rename core.stringhelpers to core.strings.helpers 2026-03-11 19:41:50 +00:00
Aaron 17ee64ba02 refactor: rename core.search to core.stringhelpers 2026-03-11 19:41:50 +00:00
Aaron 6383b35945 remove debug file 2026-03-11 19:41:50 +00:00
Aaron b9e6c53be2 removed unused icons 2026-03-11 19:41:49 +00:00
Aaron abac1ce4a3 fix: replace raw mouse hook with LVGL long-press for file browser context menu
Removed driver.hid.mouse dependency that caused page fault on close.
Context menu now triggers via LV_EVENT_LONG_PRESSED on content rows.
Cleaned up onClose teardown ordering and removed debug syslog markers.
2026-03-11 19:41:49 +00:00
Aaron 5628c1ddbf feat: file dispatch system, file-type icons, multi-instance notepad
- Add extension-based dispatch to driver.storage.filedispatch with typed
  union (variant record THandlerKind = hkMagic/hkExtension)
- Extract file-type icon constants and mapping to core.gfx.fileicons
- Add core.search utility (getFileExtension, fmtFileSize, sortStringArray)
- Generate PUA bitmap icon fonts (32/64/128px) from Font Awesome via
  gen_file_icons.py + compile_icons.sh toolchain
- Integrate file dispatch into file browser (double-click triggers dispatch)
- Register notepad as handler for text file extensions
- Fix init order in app.mgr (filedispatch.init before app inits)
- Refactor notepad from singleton to multi-instance (up to 8 windows)
  using instance array, findStateByWid, and LVGL user_data on msgboxes
2026-03-11 19:41:49 +00:00
admin 140d3d6d68 Merge pull request 'feature: add RFC 8259 JSON parser/serializer and string utility extensions' (#62) from feature/json into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #62
Reviewed-by: Aaron Hance <[email protected]>
2026-03-10 19:26:24 +00:00
admin 1ff6e7549d Merge pull request 'feature: mirror all diagnostics to syslog, add VESA fallback for gfxd crashes' (#63) from feature/panic-fallback into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #63
Reviewed-by: Aaron Hance <[email protected]>
2026-03-10 19:26:02 +00:00
t3hn3rd aa28d62e03 feature: mirror all diagnostics to syslog, add VESA fallback for gfxd crashes
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
- syslogDump now outputs all five diagnostic sections (Fault Info,
  CPU Registers, Process Info, System Info, Call Stack) to serial,
  matching the on-screen BSOD content
- panic() detects if the crash occurred in the gfxd process and
  falls back to rendering the BSOD directly to the VESA framebuffer
  via driver.video text drawing, bypassing LVGL entirely
- Add DrawChar, DrawString, DrawHex, DrawInt to driver.video for
  8x16 bitmap font rendering directly to the framebuffer
- Export SHOULD_CRASH flag from svc.gfxd interface so test commands
  can trigger a deliberate gfxd crash
- Add app.divzero with DIV0, PF, and CRASHGFXD test commands
- Update doc/src/core/core.panic.md and doc/src/driver/video/driver.video.md
2026-03-10 12:35:22 +00:00
t3hn3rd 63f6c5ecc1 feature: add RFC 8259 JSON parser/serializer and string utility extensions
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Add core.fmt.json — a complete RFC 8259 JSON library with recursive-descent
parser, serializer, builders, dot/bracket path accessors, and full cleanup.
Supports all 6 JSON value types plus JSON_ERROR for parse error reporting.
Numbers stored as Double via x87 FPU. Unicode \uXXXX escapes handled
(ASCII range emitted, non-ASCII replaced with '?').

Supporting changes:
- core.strings: add int64ToString, doubleToStr (scientific notation for
  very large/small values, fixed-point for normal range, trailing zero
  trimming), plus unit tests for both
- asuro.pas: wire core.fmt.json.UnitTest into the boot test suite
- mkdocs.yml: add JSON nav entry under Formats
- doc/src/core/fmt/core.fmt.json.md: full API documentation
- doc/src/core/core.strings.md: document int64ToString and doubleToStr
- doc/planning/json.md: implementation plan and design spec
- doc/planning/webgpu.md: WebGPU-over-WASM design plan (software
  rasterizer backend for WASM apps importing webgpu.h)
2026-03-10 11:51:48 +00:00
15 changed files with 2901 additions and 12 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+21 -3
View File
@@ -4,7 +4,9 @@ Architecture-agnostic kernel panic (BSOD) engine.
## Overview
`core.panic` implements a graphical and serial kernel panic handler for the Asuro kernel. When a fatal condition is detected anywhere in the kernel, `panic` is called with a fault identifier, a human-readable description, and an optional CPU register snapshot. The unit outputs the fault information to the serial syslog for headless debugging and, if LVGL has been initialised, displays a graphical Blue Screen of Death (BSOD).
`core.panic` implements a graphical and serial kernel panic handler for the Asuro kernel. When a fatal condition is detected anywhere in the kernel, `panic` is called with a fault identifier, a human-readable description, and an optional CPU register snapshot. All diagnostic sections (Fault Info, CPU Registers, Process Info, System Info, Call Stack) are mirrored to the serial syslog for headless debugging. If LVGL has been initialised, a graphical Blue Screen of Death (BSOD) is displayed.
If the panic occurs inside the `gfxd` graphics-rendering process, LVGL state may be corrupt. In this case the unit falls back to rendering the panic screen directly to the VESA framebuffer using `driver.video.DrawString`, `driver.video.DrawHex`, and `driver.video.DrawInt`, bypassing LVGL entirely.
The BSOD screen and all its LVGL widgets are pre-allocated at `init` time so that no dynamic LVGL allocation is needed when a panic fires. At panic time only label text is updated via `lv_label_set_text`, the pre-built screen is loaded, and a single render pass is forced. Text formatting uses static heap buffers and avoids calling any string library routines that might themselves fault.
@@ -16,7 +18,7 @@ If `init` has not been called before a panic (early boot panic), the unit gracef
- `io.syslog` — serial fault output
- `debug.tracer` — call-stack capture and freeze
- `driver.video` — frame buffer flush
- `driver.video` — frame buffer flush and text drawing (DrawString, DrawHex, DrawInt) for VESA fallback
- `memory.heap` — buffer allocation
- `driver.video.lvgl` — LVGL widget creation and rendering
- `core.version` — version constants for the system info panel
@@ -24,6 +26,8 @@ If `init` has not been called before a panic (early boot panic), the unit gracef
- `proc.types` — process state enumeration
- `core.fmt.targa` — teapot TGA image decoding
- `core.gfx.texture` — pixel buffer type
- `core.strings` — string comparison for gfxd process detection
- `core.gfx.color` — TRGB32 colour type for direct pixel drawing
## Constants
@@ -71,7 +75,7 @@ Creates the hidden BSOD LVGL screen and pre-allocates all widget objects and tex
```pascal
procedure panic(fault : pchar; info : pchar; regs : PRegisterSnapshot);
```
Triggers a kernel panic. Freezes the call-stack tracer, dumps fault information to syslog, and (if the BSOD screen is ready) displays the graphical panic screen. Then calls the registered halt procedure. Re-entrant calls are detected by a guard flag; if `panic` is called while a panic is already in progress, the system halts immediately without further output.
Triggers a kernel panic. Freezes the call-stack tracer, dumps all diagnostic sections (Fault Info, CPU Registers, Process Info, System Info, Call Stack) to syslog, and displays the graphical panic screen. If the crash occurred in the `gfxd` process, LVGL is bypassed and the screen is rendered directly to the VESA framebuffer. Otherwise, if the LVGL BSOD screen is ready, it is used. Then calls the registered halt procedure. Re-entrant calls are detected by a guard flag; if `panic` is called while a panic is already in progress, the system halts immediately without further output.
Parameters:
- `fault` — short fault identifier string, e.g. `'arch.x86.fault.gpf'`.
@@ -93,3 +97,17 @@ The teapot image is loaded from a TGA binary linked into the kernel image via an
All text formatting in the panic path uses a set of internal buffer-writing helpers (`writeHexToBuffer`, `writeStrToBuffer`, `writeIntToBuffer`) that do not call the kernel string library, making the panic path robust against faults in those subsystems.
A compile-time switch `BSOD_ENABLE` gates the display path; if disabled, `panic` only writes to syslog and halts.
### gfxd Crash Detection
When `panic` is triggered, it checks whether the currently executing process is `gfxd` (the graphics daemon). If so, LVGLs internal state may be corrupt (since `gfxd` drives the LVGL render pipeline), so the unit falls back to `showVESAFallbackScreen`. This procedure fills the screen with the BSOD background colour and renders all diagnostic sections using `driver.video.DrawString`, `driver.video.DrawHex`, and `driver.video.DrawInt` (which draw 8×16 bitmap font glyphs via `DrawPixel`). The layout mirrors the LVGL BSOD but uses a simpler single-column text format.
### Syslog Output
All five diagnostic sections are written to syslog in every panic, regardless of the display path:
1. **Fault Info** — fault identifier and human-readable description
2. **CPU Registers** — name/value pairs from the register snapshot
3. **Process Info** — name, PID, parent PID, state, and priority of the current process
4. **System Info** — kernel version, build date, compiler, revision, heap status, process count, uptime
5. **Call Stack** — frozen tracer output
+12
View File
@@ -106,6 +106,12 @@ function intToString(i : uint32) : pchar;
```
Returns a heap-allocated decimal string representation of `i`.
### int64ToString
```pascal
function int64ToString(i : int64) : pchar;
```
Returns a heap-allocated decimal string representation of the signed 64-bit integer `i`. Negative values are prefixed with `'-'`.
### hexStringToInt
```pascal
function hexStringToInt(str : pchar) : uint32;
@@ -118,6 +124,12 @@ function boolToString(b : boolean; ext : boolean) : pchar;
```
Returns a heap-allocated string for the boolean `b`. When `ext` is `true`, returns `'true'` or `'false'`; when `false`, returns `'1'` or `'0'`.
### doubleToStr
```pascal
function doubleToStr(d : Double) : pchar;
```
Returns a heap-allocated decimal string representation of the 64-bit floating-point value `d`. Integer values are emitted without a decimal point (e.g. `42`). Fractional values include up to 15 significant digits with trailing zeros removed. Very large or very small values use scientific notation (e.g. `1.5e+20`).
### UnitTest
```pascal
procedure UnitTest;
File diff suppressed because it is too large Load Diff
+29
View File
@@ -13,6 +13,7 @@ This unit is the central video interface for the Asuro kernel. It holds a single
- `driver.video.gpu`
- `driver.video.vesa32` (and other BPP variants)
- `core.hashmap`
- `core.gfx.fonts` — 8×16 bitmap font data for text drawing
- `syslog`
## Functions and Procedures
@@ -69,6 +70,34 @@ function backBuffer: PVideoBuffer;
```
Returns a pointer to `VideoInterface.BackBuffer`.
## Text Drawing
These functions render text directly to the framebuffer using the 8×16 bitmap font from `core.gfx.fonts`. They are useful for panic screens or other contexts where LVGL is unavailable. Each function returns the X coordinate immediately after the last drawn pixel, allowing calls to be chained for inline formatting.
### DrawChar
```pascal
function DrawChar(X, Y : uint32; C : char; Color : TRGB32) : uint32;
```
Draws a single 8×16 bitmap glyph at `(X, Y)` in the given colour. Returns `X + 8`.
### DrawString
```pascal
function DrawString(X, Y : uint32; Str : pchar; Color : TRGB32) : uint32;
```
Draws a null-terminated string starting at `(X, Y)`. Each character advances X by 8 pixels. Returns the X coordinate after the last character.
### DrawHex
```pascal
function DrawHex(X, Y : uint32; Value : uint32; Color : TRGB32) : uint32;
```
Draws a `uint32` as a `0xHHHHHHHH` hex string at `(X, Y)`. Returns the X coordinate after the string.
### DrawInt
```pascal
function DrawInt(X, Y : uint32; Value : uint32; Color : TRGB32) : uint32;
```
Draws an unsigned integer in decimal at `(X, Y)`. Returns the X coordinate after the last digit.
## Notes
- All drawing operations target the back buffer (`DefaultBuffer`) when double buffering is active. `Flush` transfers the result to the front (visible) buffer.
+1
View File
@@ -136,6 +136,7 @@ nav:
- MD5: src/core/enc/core.enc.md5.md
- SHA-1: src/core/enc/core.enc.sha1.md
- Formats:
- JSON: src/core/fmt/core.fmt.json.md
- Targa (TGA): src/core/fmt/core.fmt.targa.md
- Graphics:
- Color: src/core/gfx/core.gfx.color.md
+57
View File
@@ -0,0 +1,57 @@
{
Prog->Ping - ICMP Ping command.
Sends 10 ICMP echo requests to a host, printing round-trip time
for each reply. Sleeps 1 second between pings. Each invocation
uses a heap-allocated state record so multiple terminals can app.ping
concurrently without corrupting each other.
@author(Kieron Morris <[email protected]>)
}
unit app.divzero;
interface
uses
io.stdio, debug.tracer;
procedure init();
implementation
uses
arch.x86.bda, driver.net.types, driver.net.proto.icmp, driver.net.util, core.strings,
proc.mgr, core.util, arch.x86.util, memory.heap, svc.gfxd;
{ ---- Command entry point (runs as a process) ---- }
procedure run_div0(Params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
begin
asm
XOR EAX, EAX
DIV EAX { this will trigger a divide by zero exception (interrupt 0) }
end;
end;
procedure run_pf(Params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
begin
asm
MOV EAX, $DEADBEEF
MOV [EAX], EAX { this will trigger a page fault (interrupt 14) }
end;
end;
procedure run_div0_gfxd(Params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
begin
svc.gfxd.SHOULD_CRASH := true; { set flag to trigger crash in graphics service }
end;
procedure init();
begin
debug.tracer.push_trace('divzero.init');
io.stdio.registerCommand('DIV0', @run_div0, 'Force a divide by zero exception.');
io.stdio.registerCommand('PF', @run_pf, 'Force a page fault.');
io.stdio.registerCommand('CRASHGFXD', @run_div0_gfxd, 'Force a divide by zero exception in the graphics service.');
end;
end.
+3 -1
View File
@@ -33,7 +33,8 @@ uses
//dispatch
driver.storage.filedispatch,
//wasm
app.wasm.runner;
app.wasm.runner,
app.divzero;
{ Initialize all baked-in programs }
procedure init();
@@ -84,6 +85,7 @@ begin
{ WASM & remaining apps }
app.wasm.runner.init();
app.setres.init();
app.divzero.init();
app.filebrowser.init();
end;
+4 -1
View File
@@ -118,7 +118,8 @@ uses
wasm.test,
wasm.test.framework,
driver.video.windows,
driver.bus.usb.xhci;
driver.bus.usb.xhci,
core.fmt.json;
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
@@ -354,9 +355,11 @@ begin
core.ds.prio.UnitTest;
driver.storage.vfs.UnitTest;
driver.storage.test.UnitTest;
boot.splash.update(95, 'Running test suite...');
core.enc.fnv1a.UnitTest;
core.enc.djb2.UnitTest;
core.ds.bloom.UnitTest;
core.fmt.json.UnitTest;
{ Initialize driver.video.desktop environment }
boot.splash.update(100, 'Booting desktop...');
+240 -6
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+84 -1
View File
@@ -22,7 +22,7 @@ unit driver.video;
interface
uses
memory.heap, debug.tracer, core.gfx.color, driver.video.types, core.ds.hashmap, core.util, arch.x86.util, core.gfx.texture, driver.video.gpu;
memory.heap, debug.tracer, core.gfx.color, driver.video.types, core.ds.hashmap, core.util, arch.x86.util, core.gfx.texture, driver.video.gpu, core.gfx.fonts;
procedure init();
procedure DrawPixel(X : uint32; Y : uint32; Pixel : TRGB32);
@@ -46,6 +46,14 @@ function frontBufferLocation : uint32;
Procedure basicFDrawTexture(Buffer : PVideoBuffer; X : uint32; Y : uint32; Texture : PTexture);
{ Text drawing renders 8x16 bitmap font glyphs directly to the
framebuffer via DrawPixel. Useful for panic screens and other
contexts where LVGL is unavailable. }
function DrawChar(X, Y : uint32; C : char; Color : TRGB32) : uint32;
function DrawString(X, Y : uint32; Str : pchar; Color : TRGB32) : uint32;
function DrawHex(X, Y : uint32; Value : uint32; Color : TRGB32) : uint32;
function DrawInt(X, Y : uint32; Value : uint32; Color : TRGB32) : uint32;
implementation
uses
@@ -342,6 +350,81 @@ begin
frontBufferLocation:= VideoInterface.FrontBuffer.Location;
end;
{ ============================================================
Text drawing 8x16 bitmap font via Std_Font
============================================================ }
const
HexChars : array[0..15] of char = '0123456789ABCDEF';
function DrawChar(X, Y : uint32; C : char; Color : TRGB32) : uint32;
var
row, col : uint32;
glyphRow : uint8;
begin
for row := 0 to 15 do begin
glyphRow := Std_Font[ord(C) * 16 + row];
for col := 0 to 7 do begin
if (glyphRow AND ($80 SHR col)) <> 0 then
DrawPixel(X + col, Y + row, Color);
end;
end;
DrawChar := X + 8;
end;
function DrawString(X, Y : uint32; Str : pchar; Color : TRGB32) : uint32;
var
i : uint32;
begin
i := 0;
while Str[i] <> #0 do begin
DrawChar(X, Y, Str[i], Color);
X := X + 8;
Inc(i);
end;
DrawString := X;
end;
function DrawHex(X, Y : uint32; Value : uint32; Color : TRGB32) : uint32;
var
buf : array[0..10] of char;
i : uint32;
begin
buf[0] := '0';
buf[1] := 'x';
for i := 0 to 7 do
buf[2 + i] := HexChars[(Value SHR (28 - i * 4)) AND $F];
buf[10] := #0;
DrawHex := DrawString(X, Y, @buf[0], Color);
end;
function DrawInt(X, Y : uint32; Value : uint32; Color : TRGB32) : uint32;
var
buf : array[0..11] of char;
digits : array[0..9] of char;
count : uint32;
i : uint32;
tmp : uint32;
begin
if Value = 0 then begin
buf[0] := '0';
buf[1] := #0;
DrawInt := DrawString(X, Y, @buf[0], Color);
exit;
end;
count := 0;
tmp := Value;
while tmp > 0 do begin
digits[count] := char((tmp mod 10) + ord('0'));
tmp := tmp div 10;
Inc(count);
end;
for i := 0 to count - 1 do
buf[i] := digits[count - 1 - i];
buf[count] := #0;
DrawInt := DrawString(X, Y, @buf[0], Color);
end;
procedure reinit(fb_addr, width, height, pitch : uint32; bpp : uint8);
begin
debug.tracer.push_trace('driver.video.reinit.enter');
+10
View File
@@ -13,6 +13,10 @@ unit svc.gfxd;
interface
var
SHOULD_CRASH : boolean; { set to true to intentionally trigger a crash for testing purposes }
procedure init;
implementation
@@ -58,6 +62,12 @@ begin
lvgl_unlock;
driver.video.Flush;
end;
if SHOULD_CRASH then begin
asm
XOR EAX, EAX
DIV EAX { this will trigger a divide by zero exception (interrupt 0) }
end;
end;
end;
end;