mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
clean up some obvious bugs
stuff doesn't crash but also doesn't work
This commit is contained in:
parent
ae25142acb
commit
3b0a4f2bf4
4 changed files with 16 additions and 15 deletions
|
|
@ -14,13 +14,15 @@ pub(crate) const RF_U8_BASE: usize = 0x1_0000;
|
|||
#[allow(dead_code)]
|
||||
pub(crate) const RF_U32_BASE: usize = 0x1_0000 / 4;
|
||||
#[allow(dead_code)]
|
||||
pub(crate) const RF_U32_SIZE: usize = 0x4000 / 4;
|
||||
pub(crate) const RF_TOTAL_U32_SIZE: usize = 0x4000 / 4;
|
||||
#[allow(dead_code)]
|
||||
pub(crate) const RF_U8_SIZE: usize = 0x4000;
|
||||
pub(crate) const RF_TOTAL_U8_SIZE: usize = 0x4000;
|
||||
|
||||
pub(crate) const NUM_REGS: usize = 32;
|
||||
pub(crate) const BITWIDTH: usize = 256;
|
||||
pub const RF_SIZE_IN_U32: usize = NUM_REGS*(BITWIDTH/core::mem::size_of::<u32>()); // 32 registers, 256 bits/register, divided by 4 bytes per u32
|
||||
pub(crate) const NUM_WINDOWS: usize = 16;
|
||||
pub const RF_SIZE_IN_U32: usize = NUM_REGS*(BITWIDTH/32); // 32 registers, 256 bits/register/32 bits per u32
|
||||
pub const TOTAL_RF_SIZE_IN_U32: usize = NUM_REGS*(BITWIDTH/32)*NUM_WINDOWS; // 32 registers, 256 bits/register/32 bits per u32, times 16 windows
|
||||
|
||||
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Clone, Copy)]
|
||||
pub struct Job {
|
||||
|
|
|
|||
|
|
@ -72,6 +72,8 @@ mod implementation {
|
|||
|
||||
impl Engine25519Hw {
|
||||
pub fn new(handler_conn: xous::CID) -> Engine25519Hw {
|
||||
assert!(TOTAL_RF_SIZE_IN_U32 == RF_TOTAL_U32_SIZE, "sanity check has failed on logical dimensions of register file vs hardware aperture sizes");
|
||||
|
||||
log::trace!("creating engine25519 CSR");
|
||||
let csr = xous::syscall::map_memory(
|
||||
xous::MemoryAddress::new(utra::engine::HW_ENGINE_BASE),
|
||||
|
|
@ -108,7 +110,7 @@ mod implementation {
|
|||
let rf_backing = xous::syscall::map_memory(
|
||||
None,
|
||||
None,
|
||||
RF_U8_SIZE,
|
||||
RF_TOTAL_U8_SIZE,
|
||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||
).expect("couldn't map RF backing store");
|
||||
let mut engine = Engine25519Hw {
|
||||
|
|
@ -196,9 +198,9 @@ mod implementation {
|
|||
// further reduce the ucode area to just the unaliased ucode region
|
||||
let (ucode, _) = ucode_superblock.split_at(UCODE_U32_SIZE);
|
||||
// further reduce the rf area to just the unaliased rf region
|
||||
let (rf, _) = rf_superblock.split_at(RF_U32_SIZE);
|
||||
let (rf, _) = rf_superblock.split_at(RF_TOTAL_U32_SIZE);
|
||||
|
||||
let mut rf_backing = unsafe{*(self.rf_backing.as_mut_ptr() as *mut [u32; RF_U32_SIZE])};
|
||||
let mut rf_backing = unsafe{*(self.rf_backing.as_mut_ptr() as *mut [u32; RF_TOTAL_U32_SIZE])};
|
||||
let mut ucode_backing = unsafe{*(self.ucode_backing.as_mut_ptr() as *mut [u32; UCODE_U32_SIZE])};
|
||||
|
||||
for (&src, dst) in rf.iter().zip(rf_backing.iter_mut()) {
|
||||
|
|
@ -236,9 +238,9 @@ mod implementation {
|
|||
// further reduce the ucode area to just the unaliased ucode region
|
||||
let (ucode, _) = ucode_superblock.split_at_mut(UCODE_U32_SIZE);
|
||||
// further reduce the rf area to just the unaliased rf region
|
||||
let (rf, _) = rf_superblock.split_at_mut(RF_U32_SIZE);
|
||||
let (rf, _) = rf_superblock.split_at_mut(RF_TOTAL_U32_SIZE);
|
||||
|
||||
let rf_backing = unsafe{*(self.rf_backing.as_ptr() as *const [u32; RF_U32_SIZE])};
|
||||
let rf_backing = unsafe{*(self.rf_backing.as_ptr() as *const [u32; RF_TOTAL_U32_SIZE])};
|
||||
let ucode_backing = unsafe{*(self.ucode_backing.as_ptr() as *const [u32; UCODE_U32_SIZE])};
|
||||
|
||||
for (&src, dst) in rf_backing.iter().zip(rf.iter_mut()) {
|
||||
|
|
@ -296,7 +298,7 @@ mod implementation {
|
|||
// further reduce the ucode area to just the unaliased ucode region
|
||||
let (ucode, _) = ucode_superblock.split_at_mut(UCODE_U32_SIZE);
|
||||
// further reduce the rf area to just the unaliased rf region
|
||||
let (rf, _) = rf_superblock.split_at_mut(RF_U32_SIZE);
|
||||
let (rf, _) = rf_superblock.split_at_mut(RF_TOTAL_U32_SIZE);
|
||||
|
||||
let window = if let Some(w) = job.window {
|
||||
w as usize
|
||||
|
|
@ -351,7 +353,7 @@ mod implementation {
|
|||
// first, split into the ucode/rf areas
|
||||
let (_ucode_superblock, rf_superblock) = (&mem_window).split_at(RF_U32_BASE);
|
||||
// further reduce the ucode area to just the unaliased ucode region
|
||||
let (rf, _) = rf_superblock.split_at(RF_U32_SIZE);
|
||||
let (rf, _) = rf_superblock.split_at(RF_TOTAL_U32_SIZE);
|
||||
|
||||
let mut ret_rf: [u32; RF_SIZE_IN_U32] = [0; RF_SIZE_IN_U32];
|
||||
let window = self.csr.rf(utra::engine::WINDOW_WINDOW) as usize;
|
||||
|
|
@ -449,9 +451,6 @@ fn xmain() -> ! {
|
|||
log::set_max_level(log::LevelFilter::Trace);
|
||||
log::info!("my PID is {}", xous::process::id());
|
||||
|
||||
let ticktimer = ticktimer_server::Ticktimer::new().unwrap();
|
||||
ticktimer.sleep_ms(500).unwrap();
|
||||
|
||||
let xns = xous_names::XousNames::new().unwrap();
|
||||
let engine25519_sid = xns.register_name(api::SERVER_NAME_ENGINE25519, None).expect("can't register server");
|
||||
log::trace!("registered with NS -- {:?}", engine25519_sid);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ fn run_vectors(engine: &mut Engine25519) -> (usize, usize) {
|
|||
for _vector in 0..num_vectors {
|
||||
for argcnt in 0..num_args {
|
||||
for word in 0..8 {
|
||||
job.rf[(window * 32 * 8 + argcnt * 8 + word) as usize] = vector_read(test_offset);
|
||||
job.rf[(/*window * 32 * 8 +*/ argcnt * 8 + word) as usize] = vector_read(test_offset);
|
||||
test_offset += 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ fn run_vectors(engine: &mut Engine25519) -> (usize, usize) {
|
|||
for word in 0..8 {
|
||||
let expect = vector_read(test_offset);
|
||||
test_offset += 1;
|
||||
let actual = rf_result[(window * 32 * 8 + 31 * 8 + word) as usize];
|
||||
let actual = rf_result[(/*window * 32 * 8 + */ 31 * 8 + word) as usize];
|
||||
if expect != actual {
|
||||
passed = false;
|
||||
}
|
||||
|
|
|
|||
0
services/shellchat/src/cmds/engine25519_vectors.bin
Executable file → Normal file
0
services/shellchat/src/cmds/engine25519_vectors.bin
Executable file → Normal file
Loading…
Reference in a new issue