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

23 lines
504 B
Rust
Raw Normal View History

2020-04-22 04:30:09 +04:00
// test.rs
2020-04-26 00:06:29 +04:00
use crate::{kmem::{kfree, kmalloc},
syscall::syscall_fs_read};
pub fn test_block() {
2020-04-26 00:06:29 +04:00
// Let's test the block driver!
let bytes_to_read = 1024 * 50;
let buffer = kmalloc(bytes_to_read);
unsafe {
let bytes_read = syscall_fs_read(8, 5, buffer, bytes_to_read as u32, 0);
println!("FS Read returned {} bytes", bytes_read);
for i in 0..16 * 4 {
print!("{:02x} ", buffer.add(i).read());
if (i + 1) % 16 == 0 {
println!();
}
}
}
println!();
kfree(buffer);
}