//! K2145 PID1 drain coordinator: drains the two pre-shutdown writes to //! completion, verifies a post-quiesced write is still rejected with ESHUTDOWN //! without disturbing completed records, and confirms require_quiesced reports //! the exact 384 drained bytes. #![no_std] #![no_main] use turkos_os_feature_user::{call, exit}; const WRITE: u64 = 16; const DRAIN: u64 = 17; const RECORD: u64 = 18; const REQUIRE_QUIESCED: u64 = 19; const REFUSED: u64 = 1 << 63; const ESHUTDOWN: u64 = 108; #[unsafe(no_mangle)] #[unsafe(link_section = ".text._start")] pub extern "C" fn _start(_: u64, _: u64) -> ! { let b1 = call(DRAIN, 1, 0, 0); if b1 != 128 { exit(0x11) } let b2 = call(DRAIN, 2, 0, 0); if b2 != 256 { exit(0x12) } if call(WRITE, 16, 0x5555, 0) != (REFUSED | ESHUTDOWN) { exit(0x13) } if call(RECORD, 1, 0, 0) != 128 { exit(0x14) } if call(RECORD, 2, 0, 0) != 256 { exit(0x15) } let total = call(REQUIRE_QUIESCED, 0, 0, 0); if total != 384 { exit(0x16) } exit(total) }