2020-04-22 04:30:09 +04:00
|
|
|
// test.rs
|
|
|
|
|
2020-04-25 03:58:29 +04:00
|
|
|
use crate::syscall::syscall_fs_read;
|
2020-04-24 22:39:56 +04:00
|
|
|
|
|
|
|
pub fn test_block() {
|
|
|
|
// Let's test the block driver!
|
2020-04-25 23:15:25 +04:00
|
|
|
let bytes_to_read = 1024 * 14;
|
|
|
|
let buffer = crate::kmem::kmalloc(bytes_to_read);
|
2020-04-25 02:37:48 +04:00
|
|
|
println!("Started test block process, buffer is at {:p}.", buffer);
|
2020-04-24 22:39:56 +04:00
|
|
|
unsafe {
|
2020-04-25 23:15:25 +04:00
|
|
|
syscall_fs_read(8, 5, buffer, bytes_to_read as u32, 0);
|
|
|
|
for i in 0..16*4 {
|
2020-04-24 22:39:56 +04:00
|
|
|
print!("{:02x} ", buffer.add(i).read());
|
2020-04-24 23:22:57 +04:00
|
|
|
if (i+1) % 16 == 0 {
|
|
|
|
println!();
|
|
|
|
}
|
2020-04-24 22:39:56 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
println!();
|
|
|
|
crate::kmem::kfree(buffer);
|
|
|
|
println!("Test block finished");
|
|
|
|
}
|