1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-28 04:13:31 +04:00
osblog/risc_v/src/test.rs
2020-04-24 18:56:32 -04:00

23 lines
576 B
Rust

// test.rs
use crate::syscall::{syscall_fs_read, syscall_exit};
pub fn test_block() {
// Let's test the block driver!
let buffer = crate::kmem::kmalloc(1024);
println!("Started test block process, buffer is at {:p}.", buffer);
unsafe {
syscall_fs_read(8, buffer, 0, 1024);
for i in 0..32 {
print!("{:02x} ", buffer.add(i).read());
if (i+1) % 16 == 0 {
println!();
}
}
}
println!();
crate::kmem::kfree(buffer);
println!("Test block finished");
syscall_exit();
}