From fb3a9ccdae354ffcce718be97bbfc691a0bec276 Mon Sep 17 00:00:00 2001 From: Stephen Marz Date: Tue, 31 Mar 2020 11:41:32 -0400 Subject: [PATCH] Test block device --- risc_v/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/risc_v/src/lib.rs b/risc_v/src/lib.rs index 35630ec..62fb31c 100755 --- a/risc_v/src/lib.rs +++ b/risc_v/src/lib.rs @@ -146,6 +146,18 @@ extern "C" fn kinit() { } // Set up virtio. This requires a working heap and page-grained allocator. virtio::probe(); + // Let's test the block driver! + println!("Testing block driver."); + let buffer = kmem::kmalloc(512); + block::read(8, buffer, 512, 0); + for i in 0..48 { + print!(" {:02x}", unsafe { buffer.add(i).read() }); + if 0 == ((i+1) % 24) { + println!(); + } + } + kmem::kfree(buffer); + println!("Block driver done"); // We schedule the next context switch using a multiplier of 1 // Block testing code removed. trap::schedule_next_context_switch(1);