//! K2110 slow service: answers each probe, but only after spinning on the //! architectural counter for `spin` ticks, i.e. after the probe deadline. #![no_std] #![no_main] use turkos_os_feature_user::{call, exit}; const WAIT: u64 = 16; const ANSWER: u64 = 17; const COUNTER: u64 = 18; #[unsafe(no_mangle)] #[unsafe(link_section = ".text._start")] pub extern "C" fn _start(_: u64, spin: u64) -> ! { loop { let r = call(WAIT, 0, 0, 0); match r >> 32 { 0 => {} 1 => { let start = call(COUNTER, 0, 0, 0); while call(COUNTER, 0, 0, 0).wrapping_sub(start) < spin {} call(ANSWER, r & 0xffff_ffff, 0, 0); } 2 => exit(2), 3 => exit(3), _ => exit(9), } } }