mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-21 09:14:34 +00:00
add API call to determine if in developer mode
This commit is contained in:
parent
73021cb2ed
commit
527f256ec1
4 changed files with 24 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ pub enum Opcode {
|
||||||
// ----- below are non-cryptographic opcodes but used to manipulate sensitive state -----
|
// ----- below are non-cryptographic opcodes but used to manipulate sensitive state -----
|
||||||
/// Set bootwait parameters
|
/// Set bootwait parameters
|
||||||
Bootwait = 4096,
|
Bootwait = 4096,
|
||||||
|
IsDeveloper = 4097,
|
||||||
|
|
||||||
/// Used to map unknown opcodes
|
/// Used to map unknown opcodes
|
||||||
InvalidCall = 65535,
|
InvalidCall = 65535,
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,22 @@ impl Keystore {
|
||||||
_ => unimplemented!(),
|
_ => unimplemented!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_developer(&self) -> Result<bool, xous::Error> {
|
||||||
|
match xous::send_message(
|
||||||
|
self.conn,
|
||||||
|
xous::Message::new_blocking_scalar(Opcode::IsDeveloper.to_usize().unwrap(), 0, 0, 0, 0),
|
||||||
|
)? {
|
||||||
|
xous::Result::Scalar5(_, is_developer, _, _, _) => {
|
||||||
|
if is_developer == 0 {
|
||||||
|
Ok(true)
|
||||||
|
} else {
|
||||||
|
Ok(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => unimplemented!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use core::sync::atomic::{AtomicU32, Ordering};
|
use core::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,11 @@ pub fn keystore(sid: SID) -> ! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Opcode::IsDeveloper => {
|
||||||
|
if let Some(scalar) = msg.body.scalar_message_mut() {
|
||||||
|
if store.is_developer() { scalar.arg1 = 0 } else { scalar.arg1 = 1 }
|
||||||
|
}
|
||||||
|
}
|
||||||
Opcode::InvalidCall => {
|
Opcode::InvalidCall => {
|
||||||
log::error!("Invalid call in keystore: {:?}", opcode);
|
log::error!("Invalid call in keystore: {:?}", opcode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -384,4 +384,6 @@ impl KeyStore {
|
||||||
BootWaitCoding::Disable => Ok(false),
|
BootWaitCoding::Disable => Ok(false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_developer(&self) -> bool { self.owc.get(bao1x_api::DEVELOPER_MODE).unwrap() != 0 }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue