mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
very rudimentary pddb dumper for debugging.
yah, I know. :-/ anyways.
This commit is contained in:
parent
f5a5211851
commit
1ed606fa7d
4 changed files with 33 additions and 1 deletions
|
|
@ -271,7 +271,7 @@ impl minifb::InputCallback for XousKeyboardHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log::info!("GFX|hosted: sending key {:?}", key);
|
log::debug!("GFX|hosted: sending key {:?}", key);
|
||||||
let c = self.decode_key(key);
|
let c = self.decode_key(key);
|
||||||
if c != '\u{0000}' {
|
if c != '\u{0000}' {
|
||||||
self.kbd.hostmode_inject_key(c);
|
self.kbd.hostmode_inject_key(c);
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ use crate::api::*;
|
||||||
use std::sync::Once;
|
use std::sync::Once;
|
||||||
use std::mem::MaybeUninit;
|
use std::mem::MaybeUninit;
|
||||||
|
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::prelude::*;
|
||||||
|
|
||||||
// This is considered bad practice for Rust to use a global singleton.
|
// This is considered bad practice for Rust to use a global singleton.
|
||||||
// However, this hack puts the burden of emulation on the emulator, while
|
// However, this hack puts the burden of emulation on the emulator, while
|
||||||
// keeping the production code clean (otherwise we'd have large sections
|
// keeping the production code clean (otherwise we'd have large sections
|
||||||
|
|
@ -47,6 +50,20 @@ impl EmuStorage {
|
||||||
pub fn as_mut_slice(&mut self) -> &mut [u8] {
|
pub fn as_mut_slice(&mut self) -> &mut [u8] {
|
||||||
flashmem().memory.as_mut_slice()
|
flashmem().memory.as_mut_slice()
|
||||||
}
|
}
|
||||||
|
pub fn dump_fs(&self) {
|
||||||
|
let mut f = File::create("../pddb.bin").unwrap();
|
||||||
|
f.write_all(flashmem().memory.as_slice()).unwrap();
|
||||||
|
f.flush().unwrap();
|
||||||
|
}
|
||||||
|
pub fn dump_keys(&self, known_keys: &[[u8; 32]]) {
|
||||||
|
//new().write(true).truncate(true).open
|
||||||
|
let mut f = File::create("../pddb.key").unwrap();
|
||||||
|
f.write_all(&(known_keys.len() as u32).to_le_bytes()).unwrap();
|
||||||
|
for key in known_keys {
|
||||||
|
f.write_all(key).unwrap();
|
||||||
|
}
|
||||||
|
f.flush().unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct HostedSpinor {
|
pub struct HostedSpinor {
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,18 @@ impl PddbOs {
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(any(target_os = "none", target_os = "xous")))]
|
||||||
|
pub fn dbg_dump(&self) {
|
||||||
|
self.pddb_mr.dump_fs();
|
||||||
|
if let Some(key) = self.system_basis_key {
|
||||||
|
self.pddb_mr.dump_keys(&[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||||
|
pub fn dbg_dump(&self) {
|
||||||
|
// placeholder
|
||||||
|
}
|
||||||
|
|
||||||
/// patches data at an offset starting from the data physical base address, which corresponds
|
/// patches data at an offset starting from the data physical base address, which corresponds
|
||||||
/// exactly to the first entry in the page table
|
/// exactly to the first entry in the page table
|
||||||
fn patch_data(&self, data: &[u8], offset: u32) {
|
fn patch_data(&self, data: &[u8], offset: u32) {
|
||||||
|
|
|
||||||
|
|
@ -371,6 +371,9 @@ fn xmain() -> ! {
|
||||||
pddb_os.pddb_format().unwrap();
|
pddb_os.pddb_format().unwrap();
|
||||||
log::info!("Done initializing disk");
|
log::info!("Done initializing disk");
|
||||||
|
|
||||||
|
#[cfg(not(any(target_os = "none", target_os = "xous")))]
|
||||||
|
pddb_os.dbg_dump();
|
||||||
|
|
||||||
// register a suspend/resume listener
|
// register a suspend/resume listener
|
||||||
let sr_cid = xous::connect(pddb_sid).expect("couldn't create suspend callback connection");
|
let sr_cid = xous::connect(pddb_sid).expect("couldn't create suspend callback connection");
|
||||||
let susres = susres::Susres::new(&xns, api::Opcode::SuspendResume as u32, sr_cid).expect("couldn't create suspend/resume object");
|
let susres = susres::Susres::new(&xns, api::Opcode::SuspendResume as u32, sr_cid).expect("couldn't create suspend/resume object");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue