fix killbounce & formatting

sleep killbounce wouldn't work because we started limiting the
number of connections to the LLIO.

This change makes connections to the LLIO unlimited, but perhaps later
on we should split out the I2C bus into a separate security domain,
so that the LLIO's unlimited connection policy doesn't introduce a
risk into a rogue process being able to overwrite the RTC contents.
This commit is contained in:
bunnie 2021-10-30 02:14:31 +08:00
parent 295bbd9602
commit 65bad96f52
2 changed files with 7 additions and 3 deletions

View file

@ -696,13 +696,17 @@ fn xmain() -> ! {
// - rootkeys (for reboots)
// - oqc-test (for testing the vibe motor)
// - net (for COM interrupt dispatch)
// - problem: `sleep killbounce` allocates a connection. That would bring us to 10 normally, but 11 when that function is needed.
// for now we're going to leave the total server count as "None" (open-ended) but we probably want to rethink this as
// the I2C access is in this crate. Perhaps we should split I2C out, so that the RTC can be protected and not grouped
// into the same severe security restrictions as the other LLIO items?
let num_conns = 10;
let llio_sid = xns.register_name(api::SERVER_NAME_LLIO, Some(num_conns)).expect("can't register server");
let llio_sid = xns.register_name(api::SERVER_NAME_LLIO, None).expect("can't register server");
log::trace!("registered with NS -- {:?}", llio_sid);
// create the I2C handler thread
// each connection to llio also creates an i2c connection, so it has the same expectation list
let i2c_sid = xns.register_name(api::SERVER_NAME_I2C, Some(num_conns)).expect("can't register I2C thread");
let i2c_sid = xns.register_name(api::SERVER_NAME_I2C, None).expect("can't register I2C thread");
log::trace!("registered I2C thread with NS -- {:?}", i2c_sid);
let (sid0, sid1, sid2, sid3) = i2c_sid.to_u32();
xous::create_thread_4(i2c_thread, sid0 as usize, sid1 as usize, sid2 as usize, sid3 as usize).expect("couldn't start I2C handler thread");

View file

@ -35,7 +35,7 @@ fn kill_thread(bounce: usize) {
llio.self_destruct(0x2718_2818).unwrap();
llio.self_destruct(0x3141_5926).unwrap();
com.power_off_soc().unwrap();
ticktimer.sleep_ms(100).unwrap();
ticktimer.sleep_ms(1000).unwrap();
log::info!("If you can read this, we failed to destroy ourselves!");
}
}