//! K2140 PID1: exercises unsupported-profile degraded park on Off, verifies //! false-success and host-timeout diagnoses are rejected while guest degraded //! park is accepted, then exercises bounded retry exhaustion on Reset and //! verifies a third retry is refused with RetryLimit. #![no_std] #![no_main] use turkos_os_feature_user::{call, exit}; const REQUEST: u64 = 16; const BEGIN_OFF_UNSUP: u64 = 17; const VERIFY_OFF: u64 = 19; const BEGIN_RESET_RETRY: u64 = 20; const FAIL_STEP: u64 = 21; const REFUSED: u64 = 1 << 63; const RETRY: u64 = 1; const PARK_DEGRADED: u64 = 2; #[unsafe(no_mangle)] #[unsafe(link_section = ".text._start")] pub extern "C" fn _start(_: u64, _: u64) -> ! { let off_ticket = call(REQUEST, 1, 0, 0); if off_ticket != 1 { exit(0x11) } if call(BEGIN_OFF_UNSUP, 0, 0, 0) != PARK_DEGRADED { exit(0x12) } if call(VERIFY_OFF, 0, 0, 0) & REFUSED == 0 { exit(0x13) } if call(VERIFY_OFF, 1, 0, 0) & REFUSED == 0 { exit(0x14) } if call(VERIFY_OFF, 2, 0, 0) != 0 { exit(0x15) } let reset_ticket = call(REQUEST, 2, 0, 0); if reset_ticket != 2 { exit(0x16) } if call(BEGIN_RESET_RETRY, 0, 0, 0) != RETRY { exit(0x17) } if call(FAIL_STEP, 0, 0, 0) != RETRY { exit(0x18) } if call(FAIL_STEP, 0, 0, 0) != PARK_DEGRADED { exit(0x19) } if call(FAIL_STEP, 0, 0, 0) & REFUSED == 0 { exit(0x1a) } exit(reset_ticket << 8 | PARK_DEGRADED) }