//! K2125 unauthorized shell tool: asks for power-off and reset, is denied, //! tries to cancel a ticket it never held, and keeps working afterwards. #![no_std] #![no_main] use turkos_os_feature_user::{call, exit}; const POWER: u64 = 16; const CANCEL: u64 = 17; const WORK: u64 = 18; const REFUSED: u64 = 1 << 63; #[unsafe(no_mangle)] #[unsafe(link_section = ".text._start")] pub extern "C" fn _start(_: u64, _: u64) -> ! { for op in [1, 2] { if call(POWER, op, 0, 0) & REFUSED == 0 { exit(1) } } if call(CANCEL, 0, 0, 0) & REFUSED == 0 { exit(2) } let mut done = 0; for _ in 0..8 { done = call(WORK, 0, 0, 0); } exit(done) }