feat(rust,gui): RLE compression codec + Rust Lab desktop app

Rust kernel expansion:
- rust/src/compress/mod.rs (new): memory-safe PackBits-style run-length
  encoding codec (rle_compress / rle_decompress) with C-ABI shims, registered
  in lib.rs. C fallbacks added to rust_fallback.c so aarch64/armv8i match.
- include/kernel/rust.h: FFI declarations for the codec.
- LazyBox: new `rle <text>` applet that compresses, decompresses, prints the
  ratio and verifies the round-trip is lossless.

GUI expansion:
- gui/gui_apps.c: "Rust Lab" app -- a live dashboard for the Rust subsystem.
  Shows CRC-32C/Adler-32 of a sample, measured ChaCha20/SHA3-256/AES-128
  throughput as scaled bars plus a composite score (benchmark run once at
  launch and cached), and a live ChaCha20 CSPRNG byte stream refreshed
  periodically. Per-window state freed on close.
- Registered "Rust Lab" (info icon) in the desktop app table and on the
  desktop; desktop icon indices updated for the new entry.

Verified: clean build on x86_64/aarch64/armv8i; boots through the SUB login to
the desktop with the new Rust Lab icon rendering (screenshotted); checksum
self-test prints, 0 panics / 0 OOM.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Fh5z6V7nGPbHvqVG5p4CXX
This commit is contained in:
subhobhai943andClaude Opus 4.8 committed 2026-08-25 20:06:13 +05:30
1 parent e93b994469
commit c414c20b44
8 files changed
+262 -2

No files matched your search

+30
View File
@@ -251,3 +251,33 @@ uint64_t rust_fnv1a64(const uint8_t* data, size_t len) {
}
return hash;
}
// --- RLE codec (C fallback, mirrors rust/src/compress/mod.rs) ---
int rust_rle_compress(const uint8_t* in_buf, size_t in_len, uint8_t* out_buf, size_t max_out) {
if (!in_buf || !out_buf) return -1;
size_t out = 0, i = 0;
while (i < in_len) {
uint8_t value = in_buf[i];
size_t run = 1;
while (i + run < in_len && in_buf[i + run] == value && run < 255) run++;
if (out + 2 > max_out) return -1;
out_buf[out++] = (uint8_t)run;
out_buf[out++] = value;
i += run;
}
return (int)out;
}
int rust_rle_decompress(const uint8_t* in_buf, size_t in_len, uint8_t* out_buf, size_t max_out) {
if (!in_buf || !out_buf) return -1;
size_t out = 0, i = 0;
while (i + 1 < in_len) {
size_t run = in_buf[i];
uint8_t value = in_buf[i + 1];
if (run == 0) return -1;
if (out + run > max_out) return -1;
for (size_t k = 0; k < run; k++) out_buf[out++] = value;
i += 2;
}
return (int)out;
}