Files
RedBear-OS/local/patches/kernel/P16-4a-sdt-checksum.patch
T
vasilito 45e086558e fix: boot process improvements — dependency cycle, INIT_NOTIFY, probing loop, and log spam fixes
- Fix P15-8-init-cycle-detection.patch: replace visiting+error with seen+silent-skip
  to eliminate 11 false-positive 'dependency cycle detected' errors on shared deps
- Fix P0-daemon-fix-init-notify-unwrap.patch: remove eprintln! for missing
  INIT_NOTIFY (expected for oneshot_async services, ~7 daemons affected)
- Fix driver-manager hotplug loop: add PERMANENTLY_SKIPPED static set shared
  between hotplug handler and DriverConfig::probe() to stop infinite re-probing
  of Fatal/NotSupported/deferred-exhausted device+driver pairs (e.g. ided)
- Fix driver-manager log_timeline: suppress repeated EPIPE/ENOENT errors with
  AtomicI32 dedup and AtomicBool one-shot guards for boot timeline JSON
- Add driver-manager SIGTERM handler, ACPI bus registration, --status mode,
  driver reap loop, graceful shutdown, and reduced deferred retries (30→3)
2026-05-17 12:34:02 +03:00

24 lines
758 B
Diff

--- a/src/acpi/sdt.rs
+++ b/src/acpi/sdt.rs
@@ -24,4 +24,20 @@
let header_size = size_of::<Sdt>();
total_size.saturating_sub(header_size)
}
+
+ /// Validate the SDT checksum.
+ ///
+ /// Per ACPI 6.5 §5.2.2: the entire table (including the checksum field)
+ /// must sum to 0 when all bytes are added together as unsigned 8-bit values.
+ pub fn validate_checksum(&self) -> bool {
+ let ptr = self as *const _ as *const u8;
+ let len = self.length as usize;
+ if len < size_of::<Sdt>() {
+ return false;
+ }
+ let sum = unsafe { core::slice::from_raw_parts(ptr, len) }
+ .iter()
+ .fold(0u8, |acc, &b| acc.wrapping_add(b));
+ sum == 0
+ }
}