mirror of
https://github.com/rcore-os/rCore-Tutorial-v3.git
synced 2025-01-18 21:17:14 +04:00
can run virtio gpu/block
This commit is contained in:
parent
efc35aee3b
commit
e7e7d572ba
Binary file not shown.
9
os/run.sh
Executable file
9
os/run.sh
Executable file
@ -0,0 +1,9 @@
|
||||
qemu-system-riscv64 -M 128m -machine virt \
|
||||
-bios ../bootloader/rustsbi-qemu.bin \
|
||||
-device loader,file=target/riscv64gc-unknown-none-elf/release/os.bin,addr=0x80200000 \
|
||||
-drive file=../user/target/riscv64gc-unknown-none-elf/release/fs.img,if=none,format=raw,id=x0 \
|
||||
-device virtio-blk-device,drive=x0 \
|
||||
-device virtio-gpu-device \
|
||||
-device virtio-keyboard-device \
|
||||
-device virtio-mouse-device \
|
||||
-serial stdio
|
@ -1,8 +1,8 @@
|
||||
pub const CLOCK_FREQ: usize = 12500000;
|
||||
|
||||
pub const MMIO: &[(usize, usize)] = &[
|
||||
(0x1000_0000, 0x1000), // VIRT_UART0 in virt machine
|
||||
(0x1000_1000, 0x1000), // VIRT_VIRTIO in virt machine
|
||||
(0x1000_0000, 0xa000), // VIRT_UART0 in virt machine
|
||||
// (0x1000_1000, 0x9000), // VIRT_VIRTIO with GPU in virt machine
|
||||
(0x0C00_0000, 0x40_0000), // VIRT_PLIC in virt machine
|
||||
(0x0010_0000, 0x00_2000), // VIRT_TEST/RTC in virt machine
|
||||
];
|
||||
|
@ -12,7 +12,7 @@ use lazy_static::*;
|
||||
use virtio_drivers::{BlkResp, RespStatus, VirtIOBlk, VirtIOHeader};
|
||||
|
||||
#[allow(unused)]
|
||||
const VIRTIO0: usize = 0x10001000;
|
||||
const VIRTIO0: usize = 0x10008000;
|
||||
|
||||
pub struct VirtIOBlock {
|
||||
virtio_blk: UPIntrFreeCell<VirtIOBlk<'static>>,
|
||||
|
@ -22,6 +22,7 @@ mod console;
|
||||
mod config;
|
||||
mod drivers;
|
||||
mod fs;
|
||||
mod gui;
|
||||
mod lang_items;
|
||||
mod mm;
|
||||
mod sbi;
|
||||
@ -30,7 +31,6 @@ mod syscall;
|
||||
mod task;
|
||||
mod timer;
|
||||
mod trap;
|
||||
mod gui;
|
||||
|
||||
core::arch::global_asm!(include_str!("entry.asm"));
|
||||
|
||||
@ -57,9 +57,13 @@ lazy_static! {
|
||||
pub fn rust_main() -> ! {
|
||||
clear_bss();
|
||||
mm::init();
|
||||
println!("KERN: init gpu");
|
||||
GPU_DEVICE.clone();
|
||||
println!("KERN: init keyboard");
|
||||
KEYBOARD_DEVICE.clone();
|
||||
println!("KERN: init mouse");
|
||||
MOUSE_DEVICE.clone();
|
||||
println!("KERN: init trap");
|
||||
trap::init();
|
||||
trap::enable_timer_interrupt();
|
||||
timer::set_next_trigger();
|
||||
|
Loading…
Reference in New Issue
Block a user