This commit is contained in:
2026-04-13 22:37:39 +08:00
parent f9e0190abe
commit d1d514c16a
13 changed files with 514 additions and 58 deletions

View File

@@ -23,11 +23,11 @@
- `stage24.md`
- `stage25.md`
- `stage26.md`
- `stage27.md`
- `stage28.md`
- `syscall.md` (syscall ABI reference)
## Notes
- Stage docs use a fixed template: goal, implementation, acceptance criteria, build targets, QEMU command, and debugging notes.
- Stages 16~19 are currently not documented in this folder; add them later using the same template to keep history continuous.

34
docs/stage27.md Normal file
View File

@@ -0,0 +1,34 @@
# Stage 27 - User Shell/Wine Split and Syscall Expansion
## Goal
- Expand user shell capability toward kernel-shell parity.
- Extend syscall ABI for richer process/runtime operations.
- Split CLeonOS-Wine implementation into maintainable modules.
## Implementation
- Added more user-facing commands in user shell around process/runtime control (`spawn`, `wait`, `sleep`, `yield`, `pid`, file ops under `/temp`).
- Extended syscall surface (process and runtime related IDs) and kept kernel/user syscall ID tables aligned.
- Updated user runtime syscall wrappers to cover newly added syscall IDs.
- Refactored Wine codebase from single-file implementation into modular structure for CLI, ELF loader, syscall bridge, and runtime helpers.
## Acceptance Criteria
- User shell can complete process and temp-file workflows without falling back to kernel shell.
- New syscall IDs are available consistently in:
- `clks/include/clks/syscall.h`
- `cleonos/c/include/cleonos_syscall.h`
- `cleonos/c/src/syscall.c`
- Wine entry remains runnable after split (`python cleonos_wine.py ...`).
## Build Targets
- `make userapps`
- `make ramdisk`
- `make iso`
- `make run`
## QEMU Command
- `make run`
## Debug Notes
- If a user command reports `request failed`, verify syscall ID mapping first.
- If `wait`/`spawn` behavior is wrong, check `clks/kernel/exec.c` process table and pid stack.
- If Wine import fails after split, check package/module import paths and `__init__.py` exports.

43
docs/stage28.md Normal file
View File

@@ -0,0 +1,43 @@
# Stage 28 - ANSI TTY + Default User Shell Entry + User Syscall Trace
## Goal
- Add ANSI color control support to TTY.
- Introduce ANSI-colored experience in user shell.
- Default to entering user shell after kernel is ready.
- Add serial log tracing for syscalls while user programs are running.
## Implementation
- TTY:
- Added ANSI CSI/SGR parsing (`ESC[...m`) for standard foreground/background colors.
- Added support for reset/default color behavior (`0`, `39`, `49`) and bright color range (`90..97`, `100..107`).
- Added per-cell color buffers so scrolling/redraw keeps color attributes.
- User shell:
- Colored prompt and startup text now use ANSI sequences.
- Added `ansi`/`color` command to preview palette.
- `clear` now uses ANSI clear/home sequence.
- Boot behavior:
- Enabled user shell auto-exec by default in userland manager.
- Boot log now reports default user-shell mode when auto-exec is enabled.
- Syscall tracing:
- Added bounded debug trace in `clks/kernel/syscall.c` for syscalls issued while a user-path program is active.
- Trace emits begin/end markers and syscall IDs with budget guard to avoid log flooding.
## Acceptance Criteria
- User shell prompt/output can display ANSI colors correctly on TTY.
- Boot enters default user-shell flow (auto launch enabled).
- Serial logs include syscall trace lines while user programs execute.
- Stage27 and Stage28 docs are present and indexed in `docs/README.md`.
## Build Targets
- `make userapps`
- `make ramdisk`
- `make iso`
- `make run`
## QEMU Command
- `make run`
## Debug Notes
- If ANSI text shows raw escape chars, verify `clks/kernel/tty.c` ANSI parser path is compiled.
- If user shell does not auto launch, check `clks/kernel/userland.c` auto-exec flags and retry tick flow.
- If syscall trace is missing, confirm `clks_exec_current_path_is_user()` is true during the target run.