mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
add the "trusted init" check to hosted mode
need to debug a problem with the IMEF connecting/disconnecting causing trusted init to fail when there is more than one plugin in the system.
This commit is contained in:
parent
11932898ac
commit
c46579117b
7 changed files with 40 additions and 3 deletions
|
|
@ -17,7 +17,7 @@ pub(crate) fn icontray_server() {
|
||||||
// one connection only, should be the GAM
|
// one connection only, should be the GAM
|
||||||
// however, because the predictor is connected only on demand -- we leave this as open-ended, which
|
// however, because the predictor is connected only on demand -- we leave this as open-ended, which
|
||||||
// means anyone could send something to this server if they knew the name of it.
|
// means anyone could send something to this server if they knew the name of it.
|
||||||
let ime_sh_sid = xns.register_name(SERVER_NAME_ICONTRAY, None).expect("can't register server");
|
let ime_sh_sid = xns.register_name(SERVER_NAME_ICONTRAY, None /*Some(1)*/).expect("can't register server");
|
||||||
|
|
||||||
let mytriggers = PredictionTriggers {
|
let mytriggers = PredictionTriggers {
|
||||||
newline: false,
|
newline: false,
|
||||||
|
|
|
||||||
|
|
@ -128,9 +128,14 @@ fn wrapped_main() -> ! {
|
||||||
// these connections should be established:
|
// these connections should be established:
|
||||||
// - GAM
|
// - GAM
|
||||||
// - keyrom (for verifying font maps)
|
// - keyrom (for verifying font maps)
|
||||||
|
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||||
let sid = xns
|
let sid = xns
|
||||||
.register_name(api::SERVER_NAME_GFX, Some(2))
|
.register_name(api::SERVER_NAME_GFX, Some(2))
|
||||||
.expect("can't register server");
|
.expect("can't register server");
|
||||||
|
#[cfg(not(any(target_os = "none", target_os = "xous")))]
|
||||||
|
let sid = xns
|
||||||
|
.register_name(api::SERVER_NAME_GFX, Some(1))
|
||||||
|
.expect("can't register server");
|
||||||
|
|
||||||
draw_boot_logo(&mut display);
|
draw_boot_logo(&mut display);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -510,7 +510,10 @@ fn main() -> ! {
|
||||||
// - one connection from the key server
|
// - one connection from the key server
|
||||||
// - one connection from shellchat for command line
|
// - one connection from shellchat for command line
|
||||||
// - another connection from shellchat for oqc testing
|
// - another connection from shellchat for oqc testing
|
||||||
|
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||||
let jtag_sid = xns.register_name(api::SERVER_NAME_JTAG, Some(3)).expect("can't register server");
|
let jtag_sid = xns.register_name(api::SERVER_NAME_JTAG, Some(3)).expect("can't register server");
|
||||||
|
#[cfg(not(any(target_os = "none", target_os = "xous")))]
|
||||||
|
let jtag_sid = xns.register_name(api::SERVER_NAME_JTAG, Some(2)).expect("can't register server");
|
||||||
log::trace!("registered with NS -- {:?}", jtag_sid);
|
log::trace!("registered with NS -- {:?}", jtag_sid);
|
||||||
|
|
||||||
let mut jtag = JtagMach::new();
|
let mut jtag = JtagMach::new();
|
||||||
|
|
|
||||||
|
|
@ -743,7 +743,7 @@ fn main() -> ! {
|
||||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||||
let kbd_sid = xns.register_name(api::SERVER_NAME_KBD, Some(4)).expect("can't register server");
|
let kbd_sid = xns.register_name(api::SERVER_NAME_KBD, Some(4)).expect("can't register server");
|
||||||
#[cfg(not(any(target_os = "none", target_os = "xous")))]
|
#[cfg(not(any(target_os = "none", target_os = "xous")))]
|
||||||
let kbd_sid = xns.register_name(api::SERVER_NAME_KBD, Some(5)).expect("can't register server");
|
let kbd_sid = xns.register_name(api::SERVER_NAME_KBD, Some(4)).expect("can't register server");
|
||||||
log::trace!("registered with NS -- {:?}", kbd_sid);
|
log::trace!("registered with NS -- {:?}", kbd_sid);
|
||||||
|
|
||||||
// Create a new kbd object
|
// Create a new kbd object
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,10 @@ fn main() -> ! {
|
||||||
// - time server
|
// - time server
|
||||||
// - llio
|
// - llio
|
||||||
// I2C can be used to set time, which can have security implications; we are more strict on counting who can have access to this resource.
|
// I2C can be used to set time, which can have security implications; we are more strict on counting who can have access to this resource.
|
||||||
|
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||||
let i2c_sid = xns.register_name(api::SERVER_NAME_I2C, Some(3)).expect("can't register I2C thread");
|
let i2c_sid = xns.register_name(api::SERVER_NAME_I2C, Some(3)).expect("can't register I2C thread");
|
||||||
|
#[cfg(not(any(target_os = "none", target_os = "xous")))]
|
||||||
|
let i2c_sid = xns.register_name(api::SERVER_NAME_I2C, Some(1)).expect("can't register I2C thread");
|
||||||
log::trace!("registered I2C thread with NS -- {:?}", i2c_sid);
|
log::trace!("registered I2C thread with NS -- {:?}", i2c_sid);
|
||||||
let _ = thread::spawn({
|
let _ = thread::spawn({
|
||||||
let i2c_sid = i2c_sid.clone();
|
let i2c_sid = i2c_sid.clone();
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ mod implementation {
|
||||||
jtag: jtag::Jtag,
|
jtag: jtag::Jtag,
|
||||||
xns: xous_names::XousNames,
|
xns: xous_names::XousNames,
|
||||||
ticktimer: ticktimer_server::Ticktimer,
|
ticktimer: ticktimer_server::Ticktimer,
|
||||||
|
gam: gam::Gam,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|
@ -118,10 +119,11 @@ mod implementation {
|
||||||
let jtag = jtag::Jtag::new(&xns).expect("couldn't connect to jtag server");
|
let jtag = jtag::Jtag::new(&xns).expect("couldn't connect to jtag server");
|
||||||
RootKeys {
|
RootKeys {
|
||||||
password_type: None,
|
password_type: None,
|
||||||
xns,
|
|
||||||
// must occupy tihs connection for the system to boot properly
|
// must occupy tihs connection for the system to boot properly
|
||||||
jtag,
|
jtag,
|
||||||
ticktimer: ticktimer_server::Ticktimer::new().unwrap(),
|
ticktimer: ticktimer_server::Ticktimer::new().unwrap(),
|
||||||
|
gam: gam::Gam::new(&xns).expect("couldn't connect to GAM"),
|
||||||
|
xns,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn suspend(&self) {
|
pub fn suspend(&self) {
|
||||||
|
|
@ -165,12 +167,15 @@ mod implementation {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
pub fn do_key_init(&mut self, rootkeys_modal: &mut Modal, main_cid: xous::CID) -> Result<(), RootkeyResult> {
|
pub fn do_key_init(&mut self, rootkeys_modal: &mut Modal, main_cid: xous::CID) -> Result<(), RootkeyResult> {
|
||||||
|
self.xous_init_interlock();
|
||||||
self.fake_progress(rootkeys_modal, main_cid, t!("rootkeys.setup_wait", xous::LANG))
|
self.fake_progress(rootkeys_modal, main_cid, t!("rootkeys.setup_wait", xous::LANG))
|
||||||
}
|
}
|
||||||
pub fn do_gateware_update(&mut self, rootkeys_modal: &mut Modal, main_cid: xous::CID, _provision_bbram: bool) -> Result<(), RootkeyResult> {
|
pub fn do_gateware_update(&mut self, rootkeys_modal: &mut Modal, main_cid: xous::CID, _provision_bbram: bool) -> Result<(), RootkeyResult> {
|
||||||
|
self.xous_init_interlock();
|
||||||
self.fake_progress(rootkeys_modal, main_cid, t!("rootkeys.gwup_starting", xous::LANG))
|
self.fake_progress(rootkeys_modal, main_cid, t!("rootkeys.gwup_starting", xous::LANG))
|
||||||
}
|
}
|
||||||
pub fn do_sign_xous(&mut self, rootkeys_modal: &mut Modal, main_cid: xous::CID) -> Result<(), RootkeyResult> {
|
pub fn do_sign_xous(&mut self, rootkeys_modal: &mut Modal, main_cid: xous::CID) -> Result<(), RootkeyResult> {
|
||||||
|
self.xous_init_interlock();
|
||||||
self.fake_progress(rootkeys_modal, main_cid, t!("rootkeys.init.signing_kernel", xous::LANG))
|
self.fake_progress(rootkeys_modal, main_cid, t!("rootkeys.init.signing_kernel", xous::LANG))
|
||||||
}
|
}
|
||||||
pub fn purge_password(&mut self, _ptype: PasswordType) {}
|
pub fn purge_password(&mut self, _ptype: PasswordType) {}
|
||||||
|
|
@ -293,6 +298,24 @@ mod implementation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fn xous_init_interlock(&self) {
|
||||||
|
loop {
|
||||||
|
if self.xns.trusted_init_done().expect("couldn't query init done status on xous-names") {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
log::warn!("trusted init of xous-names not finished, rootkeys is holding off on sensitive operations");
|
||||||
|
self.ticktimer.sleep_ms(650).expect("couldn't sleep");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loop {
|
||||||
|
if self.gam.trusted_init_done().expect("couldn't query init done status on GAM") {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
log::warn!("trusted init of GAM not finished, rootkeys is holding off on sensitive operations");
|
||||||
|
self.ticktimer.sleep_ms(650).expect("couldn't sleep");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -609,7 +609,10 @@ fn main() -> ! {
|
||||||
- PDDB
|
- PDDB
|
||||||
- keyboard (for updating the key map setting, which needs to be loaded upstream of the PDDB)
|
- keyboard (for updating the key map setting, which needs to be loaded upstream of the PDDB)
|
||||||
*/
|
*/
|
||||||
|
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||||
let spinor_sid = xns.register_name(api::SERVER_NAME_SPINOR, Some(5)).expect("can't register server");
|
let spinor_sid = xns.register_name(api::SERVER_NAME_SPINOR, Some(5)).expect("can't register server");
|
||||||
|
#[cfg(not(any(target_os = "none", target_os = "xous")))]
|
||||||
|
let spinor_sid = xns.register_name(api::SERVER_NAME_SPINOR, Some(2)).expect("can't register server");
|
||||||
log::trace!("registered with NS -- {:?}", spinor_sid);
|
log::trace!("registered with NS -- {:?}", spinor_sid);
|
||||||
|
|
||||||
let handler_conn = xous::connect(spinor_sid).expect("couldn't create interrupt handler callback connection");
|
let handler_conn = xous::connect(spinor_sid).expect("couldn't create interrupt handler callback connection");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue