able to detect the clean suspend, now figuring out how to resume

This commit is contained in:
bunnie 2021-04-30 05:00:03 +08:00
parent 0e2d57c9fb
commit 7053c2b7c6
2 changed files with 116 additions and 72 deletions

View file

@ -36,6 +36,8 @@ const FLG_A: usize = 0x40;
const FLG_D: usize = 0x80; const FLG_D: usize = 0x80;
const STACK_PAGE_COUNT: usize = 5; const STACK_PAGE_COUNT: usize = 5;
const VDBG: bool = false; // verbose debug
mod debug; mod debug;
mod fonts; mod fonts;
@ -263,7 +265,7 @@ impl MiniElf {
// Example: Page starts at 0xf0c0 and is 128 bytes long // Example: Page starts at 0xf0c0 and is 128 bytes long
// 1. Copy 128 bytes to page 1 // 1. Copy 128 bytes to page 1
for section in self.sections { for section in self.sections {
println!(" Section @ {:08x}", section.virt as usize); if VDBG {println!(" Section @ {:08x}", section.virt as usize);}
let flag_defaults = FLG_U let flag_defaults = FLG_U
| FLG_R | FLG_R
| if section.flags() & 1 == 1 { FLG_W } else { 0 } | if section.flags() & 1 == 1 { FLG_W } else { 0 }
@ -279,7 +281,7 @@ impl MiniElf {
// If this is not a new page, ensure the uninitialized values from between // If this is not a new page, ensure the uninitialized values from between
// this section and the previous one are all zeroed out. // this section and the previous one are all zeroed out.
if this_page != current_page_addr { if this_page != current_page_addr {
println!("1 {:08x} -> {:08x}", top as usize, this_page); if VDBG {println!("1 {:08x} -> {:08x}", top as usize, this_page);}
allocator.map_page(satp, top as usize, this_page, flag_defaults); allocator.map_page(satp, top as usize, this_page, flag_defaults);
allocator.change_owner(pid as XousPid, top as usize); allocator.change_owner(pid as XousPid, top as usize);
allocated_bytes += PAGE_SIZE; allocated_bytes += PAGE_SIZE;
@ -293,31 +295,31 @@ impl MiniElf {
} }
bytes_to_copy -= first_chunk_size; bytes_to_copy -= first_chunk_size;
} else { } else {
println!( if VDBG {println!(
"This page is {:08x}, and last page was {:08x}", "This page is {:08x}, and last page was {:08x}",
this_page, current_page_addr this_page, current_page_addr
); );}
// This is a continuation of the previous section, and as a result // This is a continuation of the previous section, and as a result
// the memory will have been copied already. Avoid copying this data // the memory will have been copied already. Avoid copying this data
// to a new page. // to a new page.
let first_chunk_size = PAGE_SIZE - (section.virt as usize & (PAGE_SIZE - 1)); let first_chunk_size = PAGE_SIZE - (section.virt as usize & (PAGE_SIZE - 1));
println!("First chunk size: {}", first_chunk_size); if VDBG {println!("First chunk size: {}", first_chunk_size);}
if bytes_to_copy < first_chunk_size { if bytes_to_copy < first_chunk_size {
bytes_to_copy = 0; bytes_to_copy = 0;
println!("Clamping to 0 bytes"); if VDBG {println!("Clamping to 0 bytes");}
} else { } else {
bytes_to_copy -= first_chunk_size; bytes_to_copy -= first_chunk_size;
println!( if VDBG {println!(
"Clamping to {} bytes by cutting off {} bytes", "Clamping to {} bytes by cutting off {} bytes",
bytes_to_copy, first_chunk_size bytes_to_copy, first_chunk_size
); );}
} }
this_page += PAGE_SIZE; this_page += PAGE_SIZE;
} }
// Part 2: Copy any full pages. // Part 2: Copy any full pages.
while bytes_to_copy > PAGE_SIZE { while bytes_to_copy > PAGE_SIZE {
println!("2 {:08x} -> {:08x}", top as usize, this_page); if VDBG {println!("2 {:08x} -> {:08x}", top as usize, this_page);}
allocator.map_page(satp, top as usize, this_page, flag_defaults); allocator.map_page(satp, top as usize, this_page, flag_defaults);
allocator.change_owner(pid as XousPid, top as usize); allocator.change_owner(pid as XousPid, top as usize);
allocated_bytes += PAGE_SIZE; allocated_bytes += PAGE_SIZE;
@ -329,7 +331,7 @@ impl MiniElf {
// Part 3: Copy the final residual partial page // Part 3: Copy the final residual partial page
if bytes_to_copy > 0 { if bytes_to_copy > 0 {
let this_page = (section.virt as usize + section.len()) & !(PAGE_SIZE - 1); let this_page = (section.virt as usize + section.len()) & !(PAGE_SIZE - 1);
println!("3 {:08x} -> {:08x}", top as usize, this_page); if VDBG {println!("3 {:08x} -> {:08x}", top as usize, this_page);}
allocator.map_page(satp, top as usize, this_page, flag_defaults); allocator.map_page(satp, top as usize, this_page, flag_defaults);
allocator.change_owner(pid as XousPid, top as usize); allocator.change_owner(pid as XousPid, top as usize);
allocated_bytes += PAGE_SIZE; allocated_bytes += PAGE_SIZE;
@ -393,6 +395,7 @@ extern "C" {
) -> !; ) -> !;
} }
impl ProgramDescription { impl ProgramDescription {
/// Map this ProgramDescription into RAM. /// Map this ProgramDescription into RAM.
/// The program may already have been relocated, and so may be /// The program may already have been relocated, and so may be
@ -481,11 +484,11 @@ impl ProgramDescription {
// let load_size_rounded = (self.text_size as usize + PAGE_SIZE - 1) & !(PAGE_SIZE - 1); // let load_size_rounded = (self.text_size as usize + PAGE_SIZE - 1) & !(PAGE_SIZE - 1);
for offset in (0..self.text_size as usize).step_by(PAGE_SIZE) { for offset in (0..self.text_size as usize).step_by(PAGE_SIZE) {
println!( if VDBG {println!(
" TEXT: Mapping {:08x} -> {:08x}", " TEXT: Mapping {:08x} -> {:08x}",
load_offset + offset + rounded_data_bss, load_offset + offset + rounded_data_bss,
self.text_offset as usize + offset self.text_offset as usize + offset
); );}
allocator.map_page( allocator.map_page(
satp, satp,
load_offset + offset + rounded_data_bss, load_offset + offset + rounded_data_bss,
@ -498,11 +501,11 @@ impl ProgramDescription {
// Map the process data section into RAM. // Map the process data section into RAM.
for offset in (0..(self.data_size + self.bss_size) as usize).step_by(PAGE_SIZE as usize) { for offset in (0..(self.data_size + self.bss_size) as usize).step_by(PAGE_SIZE as usize) {
// let page_addr = allocator.alloc(); // let page_addr = allocator.alloc();
println!( if VDBG {println!(
" DATA: Mapping {:08x} -> {:08x}", " DATA: Mapping {:08x} -> {:08x}",
load_offset + offset, load_offset + offset,
self.data_offset as usize + offset self.data_offset as usize + offset
); );}
allocator.map_page( allocator.map_page(
satp, satp,
load_offset + offset, load_offset + offset,
@ -531,7 +534,7 @@ unsafe fn bzero<T>(mut sbss: *mut T, ebss: *mut T)
where where
T: Copy, T: Copy,
{ {
println!("ZERO: {:08x} - {:08x}", sbss as usize, ebss as usize); if VDBG {println!("ZERO: {:08x} - {:08x}", sbss as usize, ebss as usize);}
while sbss < ebss { while sbss < ebss {
// NOTE(volatile) to prevent this from being transformed into `memclr` // NOTE(volatile) to prevent this from being transformed into `memclr`
ptr::write_volatile(sbss, mem::zeroed()); ptr::write_volatile(sbss, mem::zeroed());
@ -544,14 +547,14 @@ unsafe fn memcpy<T>(dest: *mut T, src: *const T, count: usize)
where where
T: Copy, T: Copy,
{ {
println!( if VDBG {println!(
"COPY: {:08x} - {:08x} {} {:08x} - {:08x}", "COPY: {:08x} - {:08x} {} {:08x} - {:08x}",
src as usize, src as usize,
src as usize + count, src as usize + count,
count, count,
dest as usize, dest as usize,
dest as usize + count dest as usize + count
); );}
let mut offset = 0; let mut offset = 0;
while offset < (count / mem::size_of::<T>()) { while offset < (count / mem::size_of::<T>()) {
dest.add(offset) dest.add(offset)
@ -647,19 +650,19 @@ fn copy_processes(cfg: &mut BootConfig) {
let this_page = section.virt as usize & !(PAGE_SIZE - 1); let this_page = section.virt as usize & !(PAGE_SIZE - 1);
let mut bytes_to_copy = section.len(); let mut bytes_to_copy = section.len();
println!( if VDBG {println!(
"Section is {} bytes long, loaded to {:08x}", "Section is {} bytes long, loaded to {:08x}",
bytes_to_copy, section.virt bytes_to_copy, section.virt
); );}
// If this is not a new page, ensure the uninitialized values from between // If this is not a new page, ensure the uninitialized values from between
// this section and the previous one are all zeroed out. // this section and the previous one are all zeroed out.
if this_page != page_addr { if this_page != page_addr {
println!("New page @ {:08x}", this_page); if VDBG {println!("New page @ {:08x}", this_page);}
if previous_addr != 0 { if previous_addr != 0 {
println!( if VDBG {println!(
"Zeroing-out remainder of previous page: {:08x} (mapped to physical address {:08x})", "Zeroing-out remainder of previous page: {:08x} (mapped to physical address {:08x})",
previous_addr, top as usize, previous_addr, top as usize,
); );}
unsafe { unsafe {
bzero( bzero(
top.add(previous_addr as usize & (PAGE_SIZE - 1)), top.add(previous_addr as usize & (PAGE_SIZE - 1)),
@ -675,7 +678,7 @@ fn copy_processes(cfg: &mut BootConfig) {
// Zero out the page, if necessary. // Zero out the page, if necessary.
unsafe { bzero(top, top.add(section.virt as usize & (PAGE_SIZE - 1))) }; unsafe { bzero(top, top.add(section.virt as usize & (PAGE_SIZE - 1))) };
} else { } else {
println!("Reusing existing page @ {:08x}", this_page); if VDBG {println!("Reusing existing page @ {:08x}", this_page);}
} }
// Part 1: Copy the first chunk over. // Part 1: Copy the first chunk over.
@ -684,7 +687,7 @@ fn copy_processes(cfg: &mut BootConfig) {
first_chunk_size = section.len(); first_chunk_size = section.len();
} }
let first_chunk_offset = section.virt as usize & (PAGE_SIZE - 1); let first_chunk_offset = section.virt as usize & (PAGE_SIZE - 1);
println!( if VDBG {println!(
"First chunk is {} bytes, copying from {:08x}:{:08x} -> {:08x}:{:08x} (virt: {:08x})", "First chunk is {} bytes, copying from {:08x}:{:08x} -> {:08x}:{:08x} (virt: {:08x})",
first_chunk_size, first_chunk_size,
src_addr as usize, src_addr as usize,
@ -693,7 +696,7 @@ fn copy_processes(cfg: &mut BootConfig) {
unsafe { top.add(first_chunk_size + first_chunk_offset) unsafe { top.add(first_chunk_size + first_chunk_offset)
as usize }, as usize },
this_page + first_chunk_offset, this_page + first_chunk_offset,
); );}
// Perform the copy, if NOCOPY is not set // Perform the copy, if NOCOPY is not set
if !section.no_copy() { if !section.no_copy() {
unsafe { unsafe {
@ -731,11 +734,11 @@ fn copy_processes(cfg: &mut BootConfig) {
// Part 3: Copy the final residual partial page // Part 3: Copy the final residual partial page
if bytes_to_copy > 0 { if bytes_to_copy > 0 {
println!( if VDBG {println!(
"Copying final section -- {} bytes @ {:08x}", "Copying final section -- {} bytes @ {:08x}",
bytes_to_copy, bytes_to_copy,
section.virt + (section.len() as u32) - (bytes_to_copy as u32) section.virt + (section.len() as u32) - (bytes_to_copy as u32)
); );}
cfg.extra_pages += 1; cfg.extra_pages += 1;
top = cfg.get_top() as *mut u8; top = cfg.get_top() as *mut u8;
if !section.no_copy() { if !section.no_copy() {
@ -750,7 +753,7 @@ fn copy_processes(cfg: &mut BootConfig) {
previous_addr = section.virt as usize + section.len(); previous_addr = section.virt as usize + section.len();
page_addr = previous_addr & !(PAGE_SIZE - 1); page_addr = previous_addr & !(PAGE_SIZE - 1);
println!("Looping to the next section"); if VDBG {println!("Looping to the next section");}
} }
println!("Done with sections, zeroing out remaining data"); println!("Done with sections, zeroing out remaining data");
@ -1110,35 +1113,70 @@ fn boot_sequence(args: KernelArguments, _signature: u32) -> ! {
println!(" Small @ {:08x}", fonts::small::DATA_SMALL.as_ptr() as u32); println!(" Small @ {:08x}", fonts::small::DATA_SMALL.as_ptr() as u32);
println!(" Bold @ {:08x}", fonts::bold::DATA_BOLD.as_ptr() as u32); println!(" Bold @ {:08x}", fonts::bold::DATA_BOLD.as_ptr() as u32);
// The MMU should be set up now, and memory pages assigned to their if !clean {
// respective processes. // The MMU should be set up now, and memory pages assigned to their
let krn_struct_start = cfg.sram_start as usize + cfg.sram_size - cfg.init_size; // respective processes.
let arg_offset = cfg.args.base as usize - krn_struct_start + KERNEL_ARGUMENT_OFFSET; let krn_struct_start = cfg.sram_start as usize + cfg.sram_size - cfg.init_size;
let ip_offset = cfg.processes.as_ptr() as usize - krn_struct_start + KERNEL_ARGUMENT_OFFSET; let arg_offset = cfg.args.base as usize - krn_struct_start + KERNEL_ARGUMENT_OFFSET;
let rpt_offset = let ip_offset = cfg.processes.as_ptr() as usize - krn_struct_start + KERNEL_ARGUMENT_OFFSET;
cfg.runtime_page_tracker.as_ptr() as usize - krn_struct_start + KERNEL_ARGUMENT_OFFSET; let rpt_offset =
println!( cfg.runtime_page_tracker.as_ptr() as usize - krn_struct_start + KERNEL_ARGUMENT_OFFSET;
"Jumping to kernel @ {:08x} with map @ {:08x} and stack @ {:08x} (kargs: {:08x}, ip: {:08x}, rpt: {:08x})", println!(
cfg.processes[0].entrypoint, cfg.processes[0].satp, cfg.processes[0].sp, "Jumping to kernel @ {:08x} with map @ {:08x} and stack @ {:08x} (kargs: {:08x}, ip: {:08x}, rpt: {:08x})",
arg_offset, ip_offset, rpt_offset, cfg.processes[0].entrypoint, cfg.processes[0].satp, cfg.processes[0].sp,
); arg_offset, ip_offset, rpt_offset,
unsafe {
start_kernel(
arg_offset,
ip_offset,
rpt_offset,
cfg.processes[0].satp,
cfg.processes[0].entrypoint,
cfg.processes[0].sp,
cfg.debug,
clean,
); );
unsafe {
let backup_args: *mut [u32; 7] = 0x40FF_F000 as *mut[u32; 7];
(*backup_args)[0] = arg_offset as u32;
(*backup_args)[1] = ip_offset as u32;
(*backup_args)[2] = rpt_offset as u32;
(*backup_args)[3] = cfg.processes[0].satp as u32;
(*backup_args)[4] = cfg.processes[0].entrypoint as u32;
(*backup_args)[5] = cfg.processes[0].sp as u32;
(*backup_args)[6] = if cfg.debug {1} else {0};
println!("Backup kernel args:");
for i in 0..7 {
println!("0x{:08x}", (*backup_args)[i]);
}
}
unsafe {
start_kernel(
arg_offset,
ip_offset,
rpt_offset,
cfg.processes[0].satp,
cfg.processes[0].entrypoint,
cfg.processes[0].sp,
cfg.debug,
clean,
);
}
} else {
unsafe {
let backup_args: *mut [u32; 7] = 0x40FF_F000 as *mut[u32; 7];
println!("Using backed up kernel args:");
for i in 0..7 {
println!("0x{:08x}", (*backup_args)[i]);
}
start_kernel(
(*backup_args)[0] as usize,
(*backup_args)[1] as usize,
(*backup_args)[2] as usize,
(*backup_args)[3] as usize,
(*backup_args)[4] as usize,
(*backup_args)[5] as usize,
if (*backup_args)[6] == 0 {false} else {true},
clean,
);
}
} }
} }
fn check_resume(cfg: &mut BootConfig) -> (bool, bool) { fn check_resume(cfg: &mut BootConfig) -> (bool, bool) {
use utralib::generated::*; use utralib::generated::*;
const WORDS_PER_SECTOR: usize = 127; const WORDS_PER_SECTOR: usize = 128;
const NUM_SECTORS: usize = 8; const NUM_SECTORS: usize = 8;
const WORDS_PER_PAGE: usize = PAGE_SIZE / 4; const WORDS_PER_PAGE: usize = PAGE_SIZE / 4;
@ -1151,11 +1189,11 @@ fn check_resume(cfg: &mut BootConfig) -> (bool, bool) {
let was_forced_suspend: bool = if unsafe{(*marker)[0]} != 0 { true } else { false }; let was_forced_suspend: bool = if unsafe{(*marker)[0]} != 0 { true } else { false };
let mut clean = true; let mut clean = true;
let mut hashbuf: [u32; WORDS_PER_SECTOR] = [0; WORDS_PER_SECTOR]; let mut hashbuf: [u32; WORDS_PER_SECTOR - 1] = [0; WORDS_PER_SECTOR - 1];
let mut index: usize = 0; let mut index: usize = 0;
for sector in 0..NUM_SECTORS { for sector in 0..NUM_SECTORS {
for i in 0..hashbuf.len() { for i in 0..hashbuf.len() {
hashbuf[i] = unsafe{(*marker)[index * (WORDS_PER_SECTOR + 1) + i]}; hashbuf[i] = unsafe{(*marker)[index * WORDS_PER_SECTOR + i]};
} }
// sector 0 contains the boot seeds, which we replace with our own as read out from our FPGA before computing the hash // sector 0 contains the boot seeds, which we replace with our own as read out from our FPGA before computing the hash
if sector == 0 { if sector == 0 {
@ -1163,8 +1201,11 @@ fn check_resume(cfg: &mut BootConfig) -> (bool, bool) {
hashbuf[2] = seed1; hashbuf[2] = seed1;
} }
let hash = crate::murmur3::murmur3_32(&hashbuf, 0); let hash = crate::murmur3::murmur3_32(&hashbuf, 0);
if hash != unsafe{(*marker)[index * (WORDS_PER_SECTOR) + 1]} { if hash != unsafe{(*marker)[(index+1) * WORDS_PER_SECTOR - 1]} {
println!("* computed 0x{:08x} - stored 0x{:08x}", hash, unsafe{(*marker)[(index+1) * (WORDS_PER_SECTOR) - 1]});
clean = false; clean = false;
} else {
println!(" computed 0x{:08x} - match", hash);
} }
index += 1; index += 1;
} }
@ -1286,21 +1327,23 @@ pub fn phase_2(cfg: &mut BootConfig) {
unsafe { (l1_pt_addr as *mut usize).add(1023).write(krn_pg1023_ptr) }; unsafe { (l1_pt_addr as *mut usize).add(1023).write(krn_pg1023_ptr) };
} }
println!("PID1 pagetables:"); if VDBG {
debug::print_pagetable(cfg.processes[0].satp); println!("PID1 pagetables:");
println!(); debug::print_pagetable(cfg.processes[0].satp);
println!();
for (_pid, process) in cfg.processes[1..].iter().enumerate() {
println!("PID{} pagetables:", _pid + 2);
debug::print_pagetable(process.satp);
println!(); println!();
println!(); println!();
for (_pid, process) in cfg.processes[1..].iter().enumerate() {
println!("PID{} pagetables:", _pid + 2);
debug::print_pagetable(process.satp);
println!();
println!();
}
} }
println!( println!(
"Runtime Page Tracker: {} bytes", "Runtime Page Tracker: {} bytes",
cfg.runtime_page_tracker.len() cfg.runtime_page_tracker.len()
); );
// mark pages used by suspend/resume as unused for later allocation by the susres server // mark pages used by suspend/resume according to their needs
cfg.runtime_page_tracker[cfg.sram_size / PAGE_SIZE - 1] = 0; // loader stack cfg.runtime_page_tracker[cfg.sram_size / PAGE_SIZE - 1] = 1; // loader stack -- do not touch as it contains kerner args
cfg.runtime_page_tracker[cfg.sram_size / PAGE_SIZE - 2] = 0; // clean suspend page cfg.runtime_page_tracker[cfg.sram_size / PAGE_SIZE - 2] = 0; // clean suspend page
} }

View file

@ -93,7 +93,7 @@ mod implementation {
/// memory region for the "clean suspend" marker /// memory region for the "clean suspend" marker
marker: xous::MemoryRange, marker: xous::MemoryRange,
/// loader stack region -- this data is dirtied on every resume; claim it in this process so no others accidentally use it /// loader stack region -- this data is dirtied on every resume; claim it in this process so no others accidentally use it
loader_stack: xous::MemoryRange, //loader_stack: xous::MemoryRange,
/// backing store for the ticktimer value /// backing store for the ticktimer value
stored_time: Option<u64>, stored_time: Option<u64>,
/// so we can access the build seed and detect if the FPGA image was changed on us /// so we can access the build seed and detect if the FPGA image was changed on us
@ -132,12 +132,12 @@ mod implementation {
4096, 4096,
xous::MemoryFlags::R | xous::MemoryFlags::W, xous::MemoryFlags::R | xous::MemoryFlags::W,
).expect("couldn't map clean suspend page"); ).expect("couldn't map clean suspend page");
let loader_stack = xous::syscall::map_memory( /*let loader_stack = xous::syscall::map_memory(
xous::MemoryAddress::new(0x40FFF000), // this is a special, hard-coded location xous::MemoryAddress::new(0x40FFF000), // this is a special, hard-coded location
None, None,
4096, 4096,
xous::MemoryFlags::R | xous::MemoryFlags::W, xous::MemoryFlags::R | xous::MemoryFlags::W,
).expect("couldn't map clean suspend page"); ).expect("couldn't map clean suspend page");*/
let seed_csr = xous::syscall::map_memory( let seed_csr = xous::syscall::map_memory(
xous::MemoryAddress::new(utra::seed::HW_SEED_BASE), xous::MemoryAddress::new(utra::seed::HW_SEED_BASE),
None, None,
@ -158,7 +158,7 @@ mod implementation {
os_timer: CSR::new(ostimer_csr.as_mut_ptr() as *mut u32), os_timer: CSR::new(ostimer_csr.as_mut_ptr() as *mut u32),
stored_time: None, stored_time: None,
marker, marker,
loader_stack, //loader_stack,
seed_csr: CSR::new(seed_csr.as_mut_ptr() as *mut u32), seed_csr: CSR::new(seed_csr.as_mut_ptr() as *mut u32),
reboot_csr: CSR::new(reboot_csr.as_mut_ptr() as *mut u32), reboot_csr: CSR::new(reboot_csr.as_mut_ptr() as *mut u32),
}; };
@ -181,11 +181,12 @@ mod implementation {
// note to self: don't use log:: here because we're upstream of logging being initialized // note to self: don't use log:: here because we're upstream of logging being initialized
assert!(unsafe{(*check_marker)[words]} == 0, "marker had non-zero entry!"); assert!(unsafe{(*check_marker)[words]} == 0, "marker had non-zero entry!");
} }
/*
// clear the loader stack, mostly to get rid of unused code warnings // clear the loader stack, mostly to get rid of unused code warnings
let stack = loader_stack.as_ptr() as *mut [u32; 1024]; let stack = loader_stack.as_ptr() as *mut [u32; 1024];
for words in 0..1024 { for words in 0..1024 {
unsafe{(*stack)[words] = 0;} unsafe{(*stack)[words] = 0;}
} }*/
xous::claim_interrupt( xous::claim_interrupt(
utra::susres::SUSRES_IRQ, utra::susres::SUSRES_IRQ,
@ -314,10 +315,10 @@ mod implementation {
// clear the loader stack, for no particular reason other than to be vengeful. // clear the loader stack, for no particular reason other than to be vengeful.
let stack = self.loader_stack.as_ptr() as *mut [u32; 1024]; /*let stack = self.loader_stack.as_ptr() as *mut [u32; 1024];
for words in 0..1024 { for words in 0..1024 {
unsafe{(*stack)[words] = 0;} unsafe{(*stack)[words] = 0;}
} }*/
println!("Triggering suspend interrupt"); println!("Triggering suspend interrupt");
// trigger an interrupt to process the final suspend bits // trigger an interrupt to process the final suspend bits
@ -368,10 +369,10 @@ mod implementation {
println!("Ticktimer and OS timer now running"); println!("Ticktimer and OS timer now running");
// clear the loader stack, for no other reason other than to be vengeful // clear the loader stack, for no other reason other than to be vengeful
let stack = self.loader_stack.as_ptr() as *mut [u32; 1024]; /*let stack = self.loader_stack.as_ptr() as *mut [u32; 1024];
for words in 0..1024 { for words in 0..1024 {
unsafe{(*stack)[words] = 0;} unsafe{(*stack)[words] = 0;}
} }*/
} else { } else {
panic!("Can't resume because the ticktimer value was not saved properly before suspend!") panic!("Can't resume because the ticktimer value was not saved properly before suspend!")
}; };