Skip to content

Commit 2b510bb

Browse files
AndrewAltimitAI Agent Botclaude
authored
Comprehensive cleanup: docs, edition 2024, new examples, build fixes (#3)
* Refactor: fix bugs, harden safety, and reduce duplication - Fix off-by-one bounds check in embedded_graphics (0..=480 -> 0..480) - Replace static mut VRAM_BASE with AtomicPtr in debug.rs - Extract shared open_psp_file() helper in test_runner.rs - DRY fminf/fmaxf into nan_aware_vfpu_op! macro in math/mod.rs - Modernize mksfo.rs: if-let over contains_key+unwrap, iterator chains, bounds checking on fixed-size buffer writes - Replace magic numbers with named constants in prxgen.rs (PF_R|PF_X, PRX_SEGMENT_ALIGN), replace unwrap() with .context() - Simplify always-true u8 <= 255 check, add debug_assert for font index Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Refactor round 2: harden safety, improve clarity, reduce duplication - Prevent double-panic by using Location::caller() fallback in panic handler - Extract read_pixel<T> helper in screenshot.rs to DRY pixel format match arms - Document allocator memory layout with ASCII diagram in alloc_impl.rs - Unify prxmin.rs main to return Result<()> like other cargo-psp binaries - Replace recursive tab expansion with loop in debug.rs - Add Display impls for VramAllocatorInUseError and VramAllocError - Consolidate redundant unsafe blocks in init_cwd (lib.rs) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Refactor round 3: fix critical gu.rs bugs, eliminate UB, harden allocators Fix sceGuDisplay returning input instead of previous state, sceGuCheckList using wrong pointer arithmetic, sceGuSetAllStatus transmuting arbitrary u32 to enum, callback_sig/callback_fin dropping the second argument, and StencilOperation doc comment swaps. Replace all core::intrinsics::unreachable() with safe unreachable!() macro across gu.rs, gum.rs, and vfpu_context.rs. Guard both allocators against align_offset returning usize::MAX and add checked_add overflow protection to std_support allocator. Fix mksfo defaults overwriting user values, prxmin double-dot extension, debug.rs LineIter off-by-one, embedded_graphics vram_base type mismatch, vram_alloc overflow, benchmark division by zero, and screenshot unstable intrinsics. Extract CONTEXTS array DRY, update paint-mode to edition 2024, remove stabilized feature gates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Revise docs, upgrade examples to edition 2024, add file-io/screenshot/audio-tone examples - Rewrite README.md: add API Overview table, Features section, Examples table; move changelog lower - Fix AGENTS.md: replace stale kernel mode description with current capabilities - Add KERNEL_MODE_PLAN.md completed status header - Upgrade 15 examples from edition 2018/2021 to 2024 - Fix edition 2024 static_mut_refs: use &raw mut for all static mut access - Fix VRAM allocator calls: add .unwrap() for Result returns - Add 3 new examples: file-io (sceIo*), screenshot (screenshot_bmp), audio-tone (sceAudio*) - Remove obsolete FromIterator import from ratatui example Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix 3 pre-existing example build failures - cube: regenerate ferris.bin at correct 128x128 RGBA size (was 65531 bytes, needs 65536) - embedded-graphics: upgrade tinybmp 0.3.1 to 0.7.0 (fixes trait mismatch with embedded-graphics 0.8.1) - rust-std-hello-world: auto-detect psp "std" feature in cargo-psp so RUST_PSP_BUILD_STD env var is no longer required Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: AI Agent Bot <ai-agent@localhost> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 661e18f commit 2b510bb

57 files changed

Lines changed: 1018 additions & 746 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ The `psp_extern!` macro generates syscall stubs with NIDs (numeric IDs) that the
106106

107107
### Kernel Mode (`--features kernel`)
108108

109-
Enables privileged PSP APIs: kernel memory partitions, interrupt handlers, PRX module loading, volatile memory access. Uses `module_kernel!()` macro. Commented-out modules (`codec.rs`, `nand.rs`, `sircs.rs`) are planned for activation in kernel mode. See `KERNEL_MODE_PLAN.md` for the 6-phase implementation roadmap.
109+
Enables privileged PSP APIs: kernel memory partitions, interrupt handlers, PRX module loading, volatile memory access, NAND flash, IR remote (SIRCS), hardware codecs, ME coprocessor control, hardware register I/O, and exception handling. Uses `module_kernel!()` macro. Key modules: `me.rs` (Media Engine boot/task), `hw.rs` (register I/O), `sys/nand.rs`, `sys/sircs.rs`, `sys/codec.rs`.
110110

111111
## Key Conventions
112112

Cargo.lock

Lines changed: 34 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

KERNEL_MODE_PLAN.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Kernel Mode Implementation Plan
22

3+
> **Status: COMPLETED** -- All 6 phases were implemented in commit `6f01ff8`. This document is retained as historical record of the design process.
4+
5+
---
6+
37
This plan covers all work needed to bring the rust-psp SDK to full kernel mode support. The primary consumer is [OASIS_OS](https://github.com/AndrewAltimit/template-repo/tree/main/packages/oasis_os), but all changes are general-purpose SDK extensions useful to any PSP homebrew project.
48

59
**Branch:** `initial_release`

0 commit comments

Comments
 (0)