Adds end-to-end WebAssembly program execution to Asuro, from build-chain integration through to runtime I/O and cleanup, along with several supporting subsystems.
New: Wasuro WASM Runtime Integration
compile_wasuro.sh - Build script that compiles the Wasuro WASM interpreter (C → .o) and links it into the kernel.
wasmrunner.pas (283 lines) - Loads .wasm files from VFS, instantiates modules via Wasuro, and launches them as kernel processes with dedicated stdout/stderr buffers.
wasmshim.pas (44 lines) - Pascal-side declarations for the Wasuro C API (wasm_decode, wasm_instantiate, wasm_call, etc.).
wasmcleanup.pas (290 lines) - Post-execution teardown: frees WASM module memory, linear memory, function tables, and all associated allocations.
New: File Dispatch System
filedispatch.pas (178 lines) - Magic-byte-based file type dispatcher. Opens a file, reads header bytes, matches against registered handlers (e.g. \0asm → WASM runner), and launches the appropriate program. Registered as the terminal's fallback command handler.
New: RAM Drive
ramdrive.pas (286 lines) - In-memory VFS volume mounted at /disk/ram. Files stored as (name, pointer, size) tuples. Implements TFilesystem hooks (readCallback, readDirCallback, readOffsetCallback, identifyCallback). Includes storeFile/storeFileCopy/removeFile API and auto-loads WASM builtins from FAT32 at boot.
Modified: VFS (vfs.pas)
File handle table - new FD-based OpenFile/ReadFile/CloseFile that works with volume-backed paths (removed old Lock parameter).
PathValid fix - otDRIVE nodes now correctly identify individual files by splitting the path into parent + leaf, listing the parent via readDirCallback, and checking each entry's type. Previously could only return pvDirectory or pvInvalid.
Modified: Desktop (desktop.pas)
Program registry converted from static array[0..MAX_PROGRAMS-1] to dynamic PLinkedListBase with lazy init.
Removed prog_count := 0 from init - programs registered before desktop.init (notepad, diskutil, etc.) are no longer wiped.
Modified: System Unit (system.pas)
Added memcpy, memset, memmove and various integer/pointer conversion helpers required by the Wasuro C runtime when linked into the Pascal kernel.
Modified: Virtual Terminal (vterminal.pas)
WASM stdout/stderr integration - terminal now renders output from WASM process buffers.
File dispatch hook - unrecognized commands fall through to filedispatch.dispatchFile.
Other
progmanager.pas - Cleaned up duplicate uses clauses; removed invalid kernel.bsod registration; registers WASM builtins and file dispatch.
kernel.pas - Added ramdrive.init and filedispatch.init to boot sequence.
contextswitcher.pas - Minor preemptive scheduling progress.
.gitignore - Added wasuro build artifacts.
Removed sha1.pas (moved to separate branch).
17 files changed, +1798 / −281
**`feature/wasm` → `develop`**
## WASM Execution Pipeline, File Dispatch & Supporting Infrastructure
Adds end-to-end WebAssembly program execution to Asuro, from build-chain integration through to runtime I/O and cleanup, along with several supporting subsystems.
### New: Wasuro WASM Runtime Integration
- **compile_wasuro.sh** - Build script that compiles the Wasuro WASM interpreter (C → `.o`) and links it into the kernel.
- **`wasmrunner.pas`** (283 lines) - Loads `.wasm` files from VFS, instantiates modules via Wasuro, and launches them as kernel processes with dedicated stdout/stderr buffers.
- **`wasmshim.pas`** (44 lines) - Pascal-side declarations for the Wasuro C API (`wasm_decode`, `wasm_instantiate`, `wasm_call`, etc.).
- **`wasmio.pas`** (246 lines) - Host-imported I/O functions exposed to WASM guests (`fd_write`, `fd_read`, `proc_exit`, `args_sizes_get`, `environ_sizes_get`, etc.).
- **`wasmcleanup.pas`** (290 lines) - Post-execution teardown: frees WASM module memory, linear memory, function tables, and all associated allocations.
### New: File Dispatch System
- **`filedispatch.pas`** (178 lines) - Magic-byte-based file type dispatcher. Opens a file, reads header bytes, matches against registered handlers (e.g. `\0asm` → WASM runner), and launches the appropriate program. Registered as the terminal's fallback command handler.
### New: RAM Drive
- **`ramdrive.pas`** (286 lines) - In-memory VFS volume mounted at `/disk/ram`. Files stored as (name, pointer, size) tuples. Implements `TFilesystem` hooks (`readCallback`, `readDirCallback`, `readOffsetCallback`, `identifyCallback`). Includes `storeFile`/`storeFileCopy`/`removeFile` API and auto-loads WASM builtins from FAT32 at boot.
### Modified: VFS (`vfs.pas`)
- **File handle table** - new FD-based `OpenFile`/`ReadFile`/`CloseFile` that works with volume-backed paths (removed old `Lock` parameter).
- **`PathValid` fix** - `otDRIVE` nodes now correctly identify individual files by splitting the path into parent + leaf, listing the parent via `readDirCallback`, and checking each entry's type. Previously could only return `pvDirectory` or `pvInvalid`.
### Modified: Desktop (desktop.pas)
- Program registry converted from static `array[0..MAX_PROGRAMS-1]` to dynamic `PLinkedListBase` with lazy init.
- Removed `prog_count := 0` from `init` - programs registered before `desktop.init` (notepad, diskutil, etc.) are no longer wiped.
### Modified: System Unit (`system.pas`)
- Added `memcpy`, `memset`, `memmove` and various integer/pointer conversion helpers required by the Wasuro C runtime when linked into the Pascal kernel.
### Modified: Virtual Terminal (`vterminal.pas`)
- WASM stdout/stderr integration - terminal now renders output from WASM process buffers.
- File dispatch hook - unrecognized commands fall through to `filedispatch.dispatchFile`.
### Other
- **`progmanager.pas`** - Cleaned up duplicate uses clauses; removed invalid `kernel.bsod` registration; registers WASM builtins and file dispatch.
- **`kernel.pas`** - Added `ramdrive.init` and `filedispatch.init` to boot sequence.
- **`contextswitcher.pas`** - Minor preemptive scheduling progress.
- **.gitignore** - Added wasuro build artifacts.
- Removed `sha1.pas` (moved to separate branch).
**17 files changed, +1798 / −281**
- Add compile_wasuro.sh to sparse-clone Wasuro src/wasm from gitea
(develop branch) with caching to skip redundant pulls
- Update compile.sh to include wasuro build step in pipeline
- Update compile_sources.sh to dynamically discover -Fu paths via
find across src/ and wasuro/ directories
- Extend system.pas with FPC 3.2.2 compilerprocs required by Wasuro:
- 64-bit signed/unsigned div and mod (fpc_div_int64, fpc_mod_int64,
fpc_div_qword, fpc_mod_qword) with correct i386 parameter mapping
- 64-bit multiply (fpc_mul_int64) via three 32-bit MUL instructions
- Float-to-integer intrinsics (Trunc, Round) using x87 FPU
- Memory allocation compilerprocs (fpc_getmem, fpc_freemem)
delegating to kernel kalloc/kfree
- Exception handling stubs (reraise, raiseexception, catches, doneexception)
- setjmp/longjmp for exception address stack
- Fix sInt64 type alias (was longint/32-bit, now int64/64-bit)
- Add serial debug helpers (COM1 $3F8) for bare-metal tracing
- Wire up Wasuro in kernel.pas: init WASM VM, set I/O callback to
syslog, and run all 1103 Wasuro tests (0 failures)
- Update .gitignore to exclude wasuro/ cache directory
- compile_wasuro.sh was copying files to the /code directory which
is not where drone builds from, fixed to use $(pwd) and relative
directories based on the root.
- ramdrive: rewrite from registerDrive callbacks to TFilesystem/TStorage_Volume
hooks (rd_Read, rd_ReadDir, rd_ReadOffset, rd_Identify) and mount via
vfs.mountVolume('/disk/ram', ...). Remove open-slot tracking; VFS now
manages file handles through the FD table.
- vfs: fix PathValid for otDRIVE nodes — split relative path into parent
directory + leaf name, list the parent via readDirCallback, and check
each entry's type so individual files are correctly identified as pvFile
instead of always returning pvDirectory or pvInvalid.
- desktop: replace static array[0..MAX_PROGRAMS-1] program registry with
a dynamic PLinkedListBase. Lazy-init on first registerProgram call.
Remove prog_count := 0 from init so programs registered before
desktop.init (e.g. notepad, diskutil) are no longer wiped.
- filedispatch, wasmrunner: add storagetypes to uses, remove stale Lock
parameter from vfs.OpenFile calls.
- progmanager: clean up duplicate uses clauses and remove invalid
kernel.bsod registration.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
feature/wasm→developWASM Execution Pipeline, File Dispatch & Supporting Infrastructure
Adds end-to-end WebAssembly program execution to Asuro, from build-chain integration through to runtime I/O and cleanup, along with several supporting subsystems.
New: Wasuro WASM Runtime Integration
.o) and links it into the kernel.wasmrunner.pas(283 lines) - Loads.wasmfiles from VFS, instantiates modules via Wasuro, and launches them as kernel processes with dedicated stdout/stderr buffers.wasmshim.pas(44 lines) - Pascal-side declarations for the Wasuro C API (wasm_decode,wasm_instantiate,wasm_call, etc.).wasmio.pas(246 lines) - Host-imported I/O functions exposed to WASM guests (fd_write,fd_read,proc_exit,args_sizes_get,environ_sizes_get, etc.).wasmcleanup.pas(290 lines) - Post-execution teardown: frees WASM module memory, linear memory, function tables, and all associated allocations.New: File Dispatch System
filedispatch.pas(178 lines) - Magic-byte-based file type dispatcher. Opens a file, reads header bytes, matches against registered handlers (e.g.\0asm→ WASM runner), and launches the appropriate program. Registered as the terminal's fallback command handler.New: RAM Drive
ramdrive.pas(286 lines) - In-memory VFS volume mounted at/disk/ram. Files stored as (name, pointer, size) tuples. ImplementsTFilesystemhooks (readCallback,readDirCallback,readOffsetCallback,identifyCallback). IncludesstoreFile/storeFileCopy/removeFileAPI and auto-loads WASM builtins from FAT32 at boot.Modified: VFS (
vfs.pas)OpenFile/ReadFile/CloseFilethat works with volume-backed paths (removed oldLockparameter).PathValidfix -otDRIVEnodes now correctly identify individual files by splitting the path into parent + leaf, listing the parent viareadDirCallback, and checking each entry's type. Previously could only returnpvDirectoryorpvInvalid.Modified: Desktop (desktop.pas)
array[0..MAX_PROGRAMS-1]to dynamicPLinkedListBasewith lazy init.prog_count := 0frominit- programs registered beforedesktop.init(notepad, diskutil, etc.) are no longer wiped.Modified: System Unit (
system.pas)memcpy,memset,memmoveand various integer/pointer conversion helpers required by the Wasuro C runtime when linked into the Pascal kernel.Modified: Virtual Terminal (
vterminal.pas)filedispatch.dispatchFile.Other
progmanager.pas- Cleaned up duplicate uses clauses; removed invalidkernel.bsodregistration; registers WASM builtins and file dispatch.kernel.pas- Addedramdrive.initandfiledispatch.initto boot sequence.contextswitcher.pas- Minor preemptive scheduling progress.sha1.pas(moved to separate branch).17 files changed, +1798 / −281
- Add compile_wasuro.sh to sparse-clone Wasuro src/wasm from gitea (develop branch) with caching to skip redundant pulls - Update compile.sh to include wasuro build step in pipeline - Update compile_sources.sh to dynamically discover -Fu paths via find across src/ and wasuro/ directories - Extend system.pas with FPC 3.2.2 compilerprocs required by Wasuro: - 64-bit signed/unsigned div and mod (fpc_div_int64, fpc_mod_int64, fpc_div_qword, fpc_mod_qword) with correct i386 parameter mapping - 64-bit multiply (fpc_mul_int64) via three 32-bit MUL instructions - Float-to-integer intrinsics (Trunc, Round) using x87 FPU - Memory allocation compilerprocs (fpc_getmem, fpc_freemem) delegating to kernel kalloc/kfree - Exception handling stubs (reraise, raiseexception, catches, doneexception) - setjmp/longjmp for exception address stack - Fix sInt64 type alias (was longint/32-bit, now int64/64-bit) - Add serial debug helpers (COM1 $3F8) for bare-metal tracing - Wire up Wasuro in kernel.pas: init WASM VM, set I/O callback to syslog, and run all 1103 Wasuro tests (0 failures) - Update .gitignore to exclude wasuro/ cache directory- ramdrive: rewrite from registerDrive callbacks to TFilesystem/TStorage_Volume hooks (rd_Read, rd_ReadDir, rd_ReadOffset, rd_Identify) and mount via vfs.mountVolume('/disk/ram', ...). Remove open-slot tracking; VFS now manages file handles through the FD table. - vfs: fix PathValid for otDRIVE nodes — split relative path into parent directory + leaf name, list the parent via readDirCallback, and check each entry's type so individual files are correctly identified as pvFile instead of always returning pvDirectory or pvInvalid. - desktop: replace static array[0..MAX_PROGRAMS-1] program registry with a dynamic PLinkedListBase. Lazy-init on first registerProgram call. Remove prog_count := 0 from init so programs registered before desktop.init (e.g. notepad, diskutil) are no longer wiped. - filedispatch, wasmrunner: add storagetypes to uses, remove stale Lock parameter from vfs.OpenFile calls. - progmanager: clean up duplicate uses clauses and remove invalid kernel.bsod registration.