feat: integrate Wasuro WASM runtime into Asuro build chain

- 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
This commit is contained in:
2026-03-07 21:24:12 +00:00
parent 0d6f1e006c
commit b51881ced7
5 changed files with 258 additions and 19 deletions
+2 -1
View File
@@ -16,4 +16,5 @@ dockerout.txt
AGENTS.md
lessons_learnt.md
*.log
/doc/*.md
/doc/*.md
wasuro
+1
View File
@@ -24,6 +24,7 @@ declare -a run_steps=(
"compile_stub.sh" "Failed to compile stub!"
"compile_vergen.sh" "Versions failed to compile"
"compile_lvgl.sh" "Failed to compile LVGL!"
"compile_wasuro.sh" "Failed to pull Wasuro!"
"compile_sources.sh" "Failed to compile FPC Sources!"
"compile_link.sh" "Failed linking!"
"compile_isogen.sh" "Failed to create ISO!"
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# compile_wasuro.sh — Pull Wasuro WASM runtime source into /wasuro
# Clones the repo (sparse, src/wasm only) and copies the Pascal sources
# into /code/wasuro so the FPC build can reference them via -Fu.
set -e
WASURO_REPO="https://gitea.spexeah.com/Spexeah/Wasuro.git"
WASURO_BRANCH="develop"
WASURO_TMP="/tmp/wasuro"
WASURO_OUT="/code/wasuro"
echo " "
echo "======================="
echo " "
echo "Pulling Wasuro WASM runtime..."
echo " "
# Skip if wasuro/ already has .pas files (cached from previous build)
if [ -n "$(find "${WASURO_OUT}" -name '*.pas' 2>/dev/null | head -1)" ]; then
echo "Wasuro sources already present in ${WASURO_OUT}, skipping pull."
echo " "
exit 0
fi
# Clone sparse checkout (only src/wasm)
rm -rf "$WASURO_TMP"
git clone --depth 1 --branch "${WASURO_BRANCH}" --filter=blob:none --sparse \
"${WASURO_REPO}" "${WASURO_TMP}" 2>&1
cd "$WASURO_TMP"
git sparse-checkout set src/wasm 2>&1
cd /code
echo "Copying src/wasm to ${WASURO_OUT}..."
rm -rf "$WASURO_OUT"
mkdir -p "$WASURO_OUT"
cp -a "${WASURO_TMP}/src/wasm/"* "$WASURO_OUT"/
rm -rf "$WASURO_TMP"
TOTAL=$(find "$WASURO_OUT" -name '*.pas' | wc -l)
echo "Copied ${TOTAL} Pascal source files."
echo " "
echo "Wasuro pull complete."
echo " "
+203 -18
View File
File diff suppressed because it is too large Load Diff
+9
View File
@@ -106,6 +106,10 @@ uses
volcmd,
volumemanager,
vterminal,
wasm,
wasm.vm.io,
wasm.test,
wasm.test.framework,
Windows,
XHCI;
@@ -243,6 +247,10 @@ begin
vfs.init();
storagetest.init;
{ Let's test Wasuro! }
wasm.vm.io.io_set_writechar(@syslog.logchar);
wasm.wasm_init;
{ Management Interfaces }
tracer.push_trace('kmain.STRMGMT');
splash.update(10, 'Initializing storage management...');
@@ -328,6 +336,7 @@ begin
cfifols.UnitTest;
lifo.UnitTest;
circ.UnitTest;
wasm.test.run_all_tests;
splash.update(90, 'Running test suite...');
minh.UnitTest;
maxh.UnitTest;