//! K2105 service B: stays alive and answers the challenge, but never //! publishes an endpoint before its deadline. It keeps polling PID1 until it //! observes the Degraded phase, then tries a late publish and reply. #![no_std] #![no_main] use turkos_os_feature_user::{call, exit}; const PUBLISH: u64 = 16; const REPLY: u64 = 17; const WAIT: u64 = 18; const LAUNCHING: u64 = 1; const DEGRADED: u64 = 3; const REFUSED: u64 = 1 << 63; #[unsafe(no_mangle)] #[unsafe(link_section = ".text._start")] pub extern "C" fn _start(nonce: u64, _: u64) -> ! { if call(REPLY, nonce, 1, 0) & REFUSED == 0 { exit(4) } loop { match call(WAIT, 0, 0, 0) { LAUNCHING => continue, DEGRADED => break, _ => exit(5), } } call(PUBLISH, 0x2105, 0, 0); if call(REPLY, nonce, 1, 0) & REFUSED == 0 { exit(6) } exit(3) }