Load dynamic programs using FAT32
This commit is contained in:
30
src/user.rs
Normal file
30
src/user.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use core::time::Duration;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use bffs::{io::Read, Fat32FileSystem};
|
||||
|
||||
use crate::{
|
||||
fs::Disk,
|
||||
syscall::{sleep, write_int_temp, write_string_temp},
|
||||
};
|
||||
|
||||
#[repr(align(32))]
|
||||
struct Alignement([u8; 157]);
|
||||
|
||||
static PROG: Alignement = Alignement(*include_bytes!("../user/test_pic/test_pic.mem"));
|
||||
|
||||
pub fn test() {
|
||||
write_int_temp(PROG.0.as_ptr() as u64);
|
||||
// unsafe { core::mem::transmute::<*const u8, extern "C" fn()>(PROG.0.as_ptr())() }
|
||||
loop {
|
||||
write_string_temp("test");
|
||||
sleep(Duration::new(2, 0));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn proc2() {
|
||||
loop {
|
||||
write_string_temp("proc2");
|
||||
sleep(Duration::new(3, 0));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user