Compare commits

..
14 Commits
Author SHA1 Message Date
t3hn3rd d059ff1ffb Rebase on develop - add VFS planning document to mkdocs nav
continuous-integration/drone/push Build is failing
- Rebase on develop
- Move vfs.md into doc/planning/ and add it to the Planning section
in mkdocs.yml.
2026-03-08 21:08:32 +00:00
t3hn3rd 16038e55e7 fix: missing index.md from doc folder 2026-03-08 21:06:14 +00:00
t3hn3rd 019c377914 fix: use pip3 and python3 -m mkdocs for Drone compatibility
The Drone runner environment does not have `pip` or `mkdocs` on PATH
even when installed via the Docker image. Use `pip3` explicitly and
invoke mkdocs as `python3 -m mkdocs` to ensure reliable execution.
Also add --break-system-packages to the fallback install.
2026-03-08 21:06:14 +00:00
t3hn3rd 26e2fd947e feature: add mkdocs-material documentation site with CI deployment
Generate comprehensive documentation for all 173 source units and
integrate mkdocs-material into the build toolchain. Documentation
covers kernel core, x86 architecture, drivers, applications, and
all subsystems with a tabbed navigation structure.

- Add mkdocs.yml with material theme, mermaid support, and tabbed nav
- Add doc/index.md landing page
- Generate doc/src/ markdown for every Pascal unit in src/
- Reorganize planning docs into doc/planning/
- Add compat, lvglh, and toolchain doc sections
- Update Dockerfile to install python3 and mkdocs-material (pinned <2)
- Replace pasdoc-based compile_docs.sh with mkdocs build --strict
- Add compile_docs.sh to the main build pipeline in compile.sh
- Add deploy-docs step in .drone.yml with host volume mount to nginx
- Add site/.gitkeep for build output directory
2026-03-08 21:06:14 +00:00
admin 7157a57513 Merge pull request 'Major rework of the Virtual File System layer covering path resolution, I/O modes, device abstractions, symlinks, and boot mount infrastructure.' (#58) from feature/vfs_improvements into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #58
Reviewed-by: admin <[email protected]>
2026-03-08 20:16:43 +00:00
Aaron c8c7c2983d vfs: symlink support in file picker, test cleanup, boot mount fix
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
- File picker (app.filepicker.pas): add otSYMLINK to directory case in
  fp_collect_cb so symlinks like /sys appear as navigable directories
- VFS: add RemoveVirtualTree() to recursively free vdir/symlink trees
- VFS UnitTest: clean up /utest_vfs tree after all tests
- STORTEST: clean up /st_test tree after tests, fix listing leak in
  cmd_stortest (GetDirectoryListingFrom result was never freed)
- Boot mount: auto-mount boot drive at /boot via mountVolume() instead
  of symlink; remove /boot and /cfg from init() vdirs
- mount.asr: remove boot line (now only 'mnt {device}/sys /sys')
2026-03-08 19:00:47 +00:00
Aaron 91bc0e5ea2 vfs: consolidate scattered type/const/var sections into single blocks 2026-03-08 18:07:44 +00:00
Aaron 2cf879c4b9 vfs: replace asr.mnt with mount.asr declarative boot mounts
- Add mount.asr parser in auto_mount_volumes: reads MOUNT.ASR from boot
  volume root, parses 'mnt {device}<src> <target>' lines, expands {device}
  to the boot volume's /disk/volN path, creates symlinks for each entry
- Remove old asr.mnt persistent mount logic from auto_mount_volumes
- Remove persistent mount write ([p] flag) from MOUNT shell command
- Remove hardcoded /boot mount for boot volumes (now driven by mount.asr)
- Add iso/mount.asr with default /boot and /sys symlinks
- Update doc/vfs.md with mount.asr documentation
2026-03-08 18:07:44 +00:00
Aaron fcc9809248 vfs: major overhaul — device nodes, stream I/O, mode simplification
- 5-phase VFS architecture overhaul (path resolution, dir cache, watch/notify,
  symlinks, async API)
- Add character/block device node layer with /dev/null and /dev/zero built-ins
- RegisterDevice() API for custom device nodes with read/write/size callbacks
- Merge TOpenMode + TWriteMode into single TOpenMode enum
  (omRead, omWrite, omCreate, omReadWrite, omStream)
- Add stream write support: WriteFile/WriteFileAsync now accept omStream handles
  with auto-advancing offset for both device and volume FDs
- Add PPWriteOffsetHook type and writeOffsetCallback field to TFilesystem
- Add PPReadOffsetHook-based streaming reads for FAT32 and ISO9660
- Update all callers (notepad, edit, inio, wasm runner, filepicker, filedispatch,
  vterminal, stdio) to new 2-param OpenFile API
- 77 unit tests (0 failures) covering path ops, dir cache, symlinks, watch,
  device nodes, and stream read/write
- Add doc/vfs.md — comprehensive public VFS API documentation
2026-03-08 18:07:44 +00:00
admin 63b67f5878 Merge pull request 'feature: add architecture-agnostic kernel panic (BSOD) engine' (#57) from feature/panic into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #57
Reviewed-by: Aaron Hance <[email protected]>
2026-03-08 17:21:41 +00:00
admin 521633c9a4 Merge pull request 'feature/bloom_filter' (#55) from feature/bloom_filter into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #55
Reviewed-by: admin <[email protected]>
2026-03-08 14:24:43 +00:00
Aaron 0cd32a0f64 Fixed file header
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-03-08 14:04:48 +00:00
Aaron f2e5f3535a perf(ds): replace MD5 key hash in hashmap with FNV-1a32
continuous-integration/drone/push Build is passing
Removes per-lookup heap allocation (MD5Buffer/kfree) in favour of a
single zero-allocation FNV-1a32 pass. Drops core.enc.md5 dependency
from core.ds.hashmap.
2026-03-08 13:59:56 +00:00
Aaron 2159578bdf feat(ds/enc): add bloom filter, FNV-1a and DJB2 hash units
continuous-integration/drone/push Build is passing
- core.enc.fnv1a: FNV-1a 32/64-bit non-cryptographic hash with UnitTest
- core.enc.djb2: DJB2 XOR/Add 32/64-bit hash variants with UnitTest
- core.ds.bloom: probabilistic bloom filter (Bloom_New/Add/Test/Clear/Free)
  using double hashing (FNV-1a32 + DJB2_32) with UnitTest
- core.ds.types: add TBloomFilter / PBloomFilter record
- asuro.pas: wire all three UnitTests into boot test suite
2026-03-08 13:58:33 +00:00
234 changed files with 20961 additions and 617 deletions

No files matched your search

+31 -1
View File
@@ -25,6 +25,30 @@ steps:
- chmod +x /drone/src/toolchain/*.sh
- /drone/src/toolchain/compile.sh
- name: deploy-docs
image: alpine:latest
depends_on:
- compile
when:
branch:
- master
- develop
- feature/mkdocs
volumes:
- name: docs-htdocs
path: /htdocs
commands:
- apk add --no-cache rsync
- |
if [ "${DRONE_BRANCH}" = "master" ]; then
DEST="/htdocs/master"
else
DEST="/htdocs/develop"
fi
- mkdir -p "$DEST"
- rsync -a --delete site/ "$DEST/"
- echo "Documentation deployed to ${DRONE_BRANCH}"
- name: upload-iso-artifact
image: alpine/git
depends_on:
@@ -63,4 +87,10 @@ steps:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_secret
message: "**Asuro Build**\n\n{{#success build.status}}✅ Build successful!\n\n{{else}}❌ Build failed!\n\n{{/success}}Repository: `{{repo.namespace}}/{{repo.name}}`\nBranch: `{{commit.branch}}`\nCommit: `{{commit.sha}}`\nAuthor: `{{commit.author}} <{{commit.email}}>`\n\nGitea Diff: [Link](<{{commit.link}}>)\nDrone Build: [Link](<{{build.link}}>)\n\nMessage: {{commit.message}}"
message: "**Asuro Build**\n\n{{#success build.status}}✅ Build successful!\n\n{{else}}❌ Build failed!\n\n{{/success}}Repository: `{{repo.namespace}}/{{repo.name}}`\nBranch: `{{commit.branch}}`\nCommit: `{{commit.sha}}`\nAuthor: `{{commit.author}} <{{commit.email}}>`\n\nGitea Diff: [Link](<{{commit.link}}>)\nDrone Build: [Link](<{{build.link}}>)\n\nMessage: {{commit.message}}"
volumes:
- name: docs-htdocs
host:
path: /mnt/user/htdocs/asuro_docs
+2 -1
View File
@@ -16,6 +16,7 @@ dockerout.txt
AGENTS.md
lessons_learnt.md
*.log
/doc/*.md
wasuro
src/core/core.version.pas
site/*
!site/.gitkeep
+4 -1
View File
@@ -5,9 +5,12 @@ VOLUME ["/code"]
ENV DEBIAN_FRONTEND=noninteractive
RUN dpkg --add-architecture i386
RUN apt-get update && apt-get install -y \
curl dos2unix wget git make nasm binutils xorriso grub-pc-bin gcc gcc-multilib && \
curl dos2unix wget git make nasm binutils xorriso grub-pc-bin gcc gcc-multilib \
python3 python3-pip && \
apt-get clean my room
RUN pip3 install --no-cache-dir --break-system-packages "mkdocs>=1.6,<2" mkdocs-material
SHELL ["/bin/bash", "-c"]
ARG FPC_VERSION=3.2.2
RUN curl -sL https://sourceforge.net/projects/freepascal/files/Linux/$FPC_VERSION/fpc-$FPC_VERSION.i386-linux.tar/download | tar -xf - && \
+1
View File
@@ -0,0 +1 @@
# Placeholder
+1
View File
@@ -0,0 +1 @@
# Placeholder
+32
View File
@@ -0,0 +1,32 @@
# Asuro OS
Asuro is a 32-bit x86 operating system kernel written in Free Pascal and x86 assembly.
## Documentation Structure
- **Kernel Entry** -- The `asuro.pas` main unit and boot sequence.
- **Architecture (x86)** -- CPU initialization, descriptor tables, interrupt handling, fault handlers, memory management, and process scheduling for the i386 target.
- **Boot** -- Splash screen and early boot visuals.
- **Core** -- Foundational libraries including data structures, encoding algorithms, string handling, graphics primitives, and the kernel panic subsystem.
- **Memory** -- Heap allocator (`kalloc`/`kfree`) and page-level allocation.
- **Processes** -- Process lifecycle, round-robin scheduling, and inter-process messaging.
- **I/O** -- Standard I/O (shell command dispatch) and the system log fan-out.
- **Debug** -- Execution tracer with ring-buffer call stack recording.
- **Drivers** -- Hardware abstraction covering PCI/USB buses, HID devices, networking (E1000, TCP/IP stack), storage (IDE, AHCI, VFS, file systems), video (VESA, LVGL, double-buffering), serial I/O, and timers.
- **Services** -- Background daemons for graphics rendering and USB hotplug.
- **Applications** -- Userland commands and utilities: terminal, text editor, disk tools, network tools, and a WebAssembly runtime.
- **Compatibility** -- Shim layers for legacy code.
- **LVGL Headers** -- Configuration and patches for the LVGL v9.2.2 GUI library.
- **Planning** -- Design documents and architectural notes for subsystems under development.
- **Toolchain** -- Build pipeline documentation covering compilation, linking, and ISO generation.
## Building
The kernel is built inside Docker using a containerized FreePascal 3.2.2 toolchain:
```bash
docker compose build builder
docker compose run builder
```
The documentation site will be available at `http://docs.asuro.xyz`.
+1
View File
@@ -0,0 +1 @@
# Placeholder
+1
View File
@@ -0,0 +1 @@
# Placeholder
+1
View File
@@ -0,0 +1 @@
# Placeholder
+941
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
File renamed without changes.
File diff suppressed because it is too large. Load diff
File renamed without changes.
File diff suppressed because it is too large. Load diff
+160
View File
File diff suppressed because it is too large. Load diff
+95
View File
@@ -0,0 +1,95 @@
# Tracer Refactor Design
## Goal
Refactor tracer.pas to eliminate all copy operations and use an O(1) ring buffer of PChar pointers. Maximize efficiency, minimize overhead, and guard against interrupt-driven corruption.
## Agreed Design Decisions
### 1. No String Copies — Store PChar Directly
- **Decision**: Trust callers. Store the `PChar` pointer directly in the ring buffer — no `StringCopy`, no `kalloc`, no `kfree`.
- **Contract**: `push_trace` MUST only be called with pointers to static/persistent data (e.g. string literals). Passing a heap-allocated or stack-allocated PChar that may later be freed is undefined behavior.
- **Rationale**: All current callers pass string literals baked into the binary. This eliminates all heap allocation from the hot path.
### 2. Ring Buffer (O(1) push)
- **Structure**: `Traces: Array[0..MAX_TRACE-1] of PChar` (static, 40 slots).
- **Index**: Single `head: uint32` variable.
- **head semantics**: `head` always points to the **most recently written** slot.
- **Push operation**:
```pascal
head := (head + 1) mod MAX_TRACE;
Traces[head] := t_name;
```
- **Read operations**:
- `get_last_trace` → `Traces[head]`
- `get_trace_N(idx)` → `Traces[(head - idx + MAX_TRACE) mod MAX_TRACE]`
- idx=0 is the most recent trace, idx=39 is the oldest.
- **No shifting loop**. Current O(n) shift of 40 entries on every push is eliminated.
### 3. Initialization
- All 40 slots set to `nil`.
- `head` initialized to `MAX_TRACE - 1` (39).
- `push_trace('kmain')` is called, which advances `head` to 0 and writes `'kmain'` to `Traces[0]`.
- After init: head = 0, Traces[0] = 'kmain', all other slots = nil.
### 4. Interrupt Safety — Locked Boolean (Skip on Contention)
- **Mechanism**: A `Locked: Boolean` reentrancy guard around `push_trace` only.
- **Behavior**: If `push_trace` is already executing (e.g., main code is mid-push) and an ISR calls `push_trace`, the ISR sees `Locked = true` and **silently drops** its trace.
- **Readers are NOT locked**: `get_last_trace` and `get_trace_N` always proceed without checking `Locked`. Since `head` is advanced AFTER the pointer is written, readers always see a consistent state.
- **Race window analysis**: There is a tiny window between checking `if not Locked` and setting `Locked := true` where an interrupt could cause both main code and ISR to enter the critical section. With the ring buffer design, the worst case is one trace being overwritten in the same slot — acceptable for a debug tracing tool.
### 5. pop_trace — No-Op Stub
- `pop_trace` remains in the interface as an empty procedure (no-op).
- This preserves ABI compatibility with all existing callers (`vmemorymanager`, `vterminal`, `kernel`, etc.) without requiring changes across the codebase.
- Traces are never removed from the ring buffer.
### 6. get_trace_count — Always Returns MAX_TRACE (40)
- No tracking of actual push count.
- Callers already handle `nil` entries from unfilled slots.
- This keeps the implementation simpler (one less variable to maintain atomically).
### 7. TRACER_ENABLE Compile-Time Guard — Kept
- All function bodies remain wrapped in `if TRACER_ENABLE then`.
- When `TRACER_ENABLE = false`, the compiler dead-code eliminates all tracer logic for zero runtime cost.
- `t_ready` provides orthogonal runtime enable/disable.
### 8. Dead Code Removal
The following unused code will be removed:
- `PTracerEntry` / `TTracerEntry` record types (linked list — never used)
- `head` / `tail` : `PTracerEntry` variables (shadow the new `head: uint32`)
- `c_lock: Boolean` (declared, never set to true, unreachable guard)
- Old `Locked: Boolean` replaced by new `Locked: Boolean` with same semantics but cleaner usage
### 9. Uses Clause Cleanup
- Remove `lmemorymanager` (no more kalloc/kfree).
- Remove `serial` (not used).
- Keep `util`, `strings`, `stdio` (used by terminal command).
## Resulting push_trace (Pseudocode)
```pascal
procedure push_trace(t_name: PChar);
begin
if TRACER_ENABLE then begin
if t_ready then begin
if not Locked then begin
Locked := true;
head := (head + 1) mod MAX_TRACE;
Traces[head] := t_name;
Locked := false;
end;
end;
end;
end;
```
## Performance Summary
| Operation | Before | After |
|---------------|--------------------|---------------|
| push_trace | O(n) shift + alloc | O(1) 2 stores |
| pop_trace | No-op | No-op |
| get_last_trace| O(1) | O(1) |
| get_trace_N | O(1) | O(1) |
| Memory alloc | kalloc per push | Zero |
| Memory free | kfree on overflow | Zero |
## Files Changed
- `src/tracer.pas` — Full rewrite of internals, interface unchanged.
+587
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
Loaded 20 of 234 files, more files were not shown because too many files have changed in this diff. Show more