2020-04-22 04:30:09 +04:00
|
|
|
// test.rs
|
|
|
|
|
2020-04-24 22:39:56 +04:00
|
|
|
extern "C" {
|
|
|
|
fn make_syscall(sysno: usize, arg0: usize, arg1: usize, arg2: usize, arg3: usize);
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn test_block() {
|
|
|
|
// Let's test the block driver!
|
|
|
|
let buffer = crate::kmem::kmalloc(1024);
|
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 {
|
|
|
|
make_syscall(63, 8, buffer as usize, 1024, 1024);
|
|
|
|
for i in 0..32 {
|
|
|
|
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");
|
2020-04-24 23:22:57 +04:00
|
|
|
unsafe {
|
|
|
|
make_syscall(93, 0, 0, 0, 0);
|
|
|
|
}
|
2020-04-24 22:39:56 +04:00
|
|
|
}
|