Skip to content

Foundation: 最低限のシェル(PCG 表示) - #11

Merged
src3453 merged 2 commits into
mainfrom
claude/project-thread-szl0vk
Oct 22, 2026
Merged

src3453 merged 2 commits into
mainfrom
claude/project-thread-szl0vk

Conversation

@src3453

@src3453 src3453 commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Requested by src3453 · project thread

概要

シェル仕様 のうち、フェーズ1カーネル(IPC・fs・proc_spawn なし)で動く部分を実装し、PCG に表示します。

  • シェル foundation/shell/shell.c(PROTECTED WAX v2、スロット 4、APP): 字句・構文(§3, §4。構文エラーの行は何も実行しない)、変数(§5.1)、行編集(§9.2。←→/Home/End/BS/Del/16 行履歴/Ctrl+C)、エラーメッセージ(§11.1)、組み込み CLS ECHO SET VER MEM PS HELP EXIT、引数なしの CD。
  • fs が必要な機能(ファイルへのリダイレクト、ワイルドカード、DIR TYPE 等、CD path)は FND_E_UNSUPPORTED、外部コマンドは command not found。
  • libfnd の一部(api.h、fnd.h、lib/fnd/): 起動・役割・fnd_write・コンソール関数・fnd_strerror。
  • 暫定: console サービスがまだないので、lib/fnd/con_pcg.c(PCG mode 1 の 80×30 表示と PeC キーボード)をシェルにリンクし、起動イメージ foundation/boot が VDP・PCG テキスト面・PeC 入力の MMIO を付与します。仕様上シェルは caps=0・MMIO なしなので、console サービスができたら置き換える前提です(README の「シェル」節に一覧)。
  • カーネル: fnd_proc_spawn_wax に MMIO 付与の引数を追加(§9.2 grants、§10.3 の窓。VRAM/PCMRAM の重複は FND_E_BUSY)、sys_info sel 0/1 を実装。
  • ツール: llvm-src32 --protected が整列の隙間で WAX ブロックを分割し、グローバルが多いと 7 ブロック制限に当たっていたのを修正(回帰テスト追加)。src32_testbench に --type FRAME=TEXT(キー注入)と --dump-pcg(画面ダンプ)を追加。

テスト

  • python -m unittest discover -s foundation/tests/shell -v: キー入力を送り PCG 画面全体を比較するシナリオ 8 件。-O0/-O1/-O2、release/debug testbench で通過。CI の toolchain ジョブに追加。
  • 既存: phase1(R1=42)、WAX ローダ testbench・ホストテスト、test_toolchain.py -k "protected or foundation"、pytest tools/wax が通過。
  • GUI での目視は未実施(Xvfb では黒画面のため)。表示には config.yaml の pcg.font が必要。

Generated by Claude Code

Implements the parts of doc/spec_Foundation_shell.md that run on the
phase 1 kernel without IPC, fs or proc_spawn: lexing and syntax (§3, §4),
variables (§5.1), the interactive line editor with history (§9.2),
messages (§11.1) and the built-ins CLS, ECHO, SET, VER, MEM, PS, HELP,
EXIT and bare CD. fs-dependent features report FND_E_UNSUPPORTED.

- libfnd subset (api.h, fnd.h, lib/fnd): startup roles, fnd_write,
  console calls, fnd_strerror. Until the console service exists, the
  console (lib/fnd/con_pcg.c, PCG mode 1 80x30 and PeC keyboard) is
  linked into the shell.
- Kernel: MMIO grants for fnd_proc_spawn_wax (§9.2, §10.3) and sys_info
  sel 0 and 1.
- foundation/boot: boot image that spawns the shell in slot 4 with the
  console grants and restarts it after EXIT.
- llvm-src32 --protected: fill alignment gaps between same-permission
  blocks so programs with many globals stay within 7 WAX blocks.
- src32_testbench: --type FRAME=TEXT injects keys, --dump-pcg prints the
  visible PCG text screen; foundation/tests/shell compares whole screens.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GUREaMPoYP4UaYgUKAhsJo
@src3453 src3453 self-assigned this Oct 22, 2026
@src3453

src3453 commented Oct 22, 2026

Copy link
Copy Markdown
Owner Author

This branch has conflicts that must be resolved

src3453 commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner Author

CI の Rust (testbench build + integration tests) が、tests/dos_smoke.rs の dos_runs_sparse_wax_and_rejects_invalid_images で失敗しました。

この PR が原因ではないと判断しています。

  • 失敗の中身:RUN APP.WAX のキーがゲストに届かず、画面は 0> で止まっています。main 側の MEMORY.md(PR CI: 統合テストが落ちても toolchain / sol テストを実行する #10)に書かれている、pec-input スレッドとの競合でキー入力が失われる症状と同じです。
  • この PR の差分は、dos.sol、PeC、CPU に触れていません。Rust の変更は src32_testbench バイナリだけです。
  • 同じテストは、前のコミット b09f6ee では通っていました。この 2 つのコミットの差は、main をマージしたことだけです(CI と MEMORY.md の変更)。

この競合はまだ修正されていません。失敗したジョブを 1 回だけ再実行しました。 [Edit: 再実行は、ワークフローがまだ実行中だったため拒否されました(403)。その後、この PR はマージされました。]


Generated by Claude Code

@src3453
src3453 merged commit d6011f2 into main Oct 22, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants