From 442e1f4d0f819d3681ac79b86d53e0d2ee61ac2d Mon Sep 17 00:00:00 2001 From: WangRunji Date: Tue, 19 Mar 2019 00:48:15 +0800 Subject: [PATCH] merge bbl crate to kernel --- crate/bbl/Cargo.toml | 6 ------ crate/bbl/src/lib.rs | 4 ---- kernel/Cargo.lock | 5 ----- kernel/Cargo.toml | 1 - kernel/src/arch/riscv32/cpu.rs | 4 ++-- kernel/src/arch/riscv32/interrupt.rs | 2 +- kernel/src/arch/riscv32/io.rs | 2 +- kernel/src/arch/riscv32/mod.rs | 2 ++ {crate/bbl/src => kernel/src/arch/riscv32}/sbi.rs | 0 kernel/src/arch/riscv32/timer.rs | 2 +- 10 files changed, 7 insertions(+), 21 deletions(-) delete mode 100644 crate/bbl/Cargo.toml delete mode 100644 crate/bbl/src/lib.rs rename {crate/bbl/src => kernel/src/arch/riscv32}/sbi.rs (100%) diff --git a/crate/bbl/Cargo.toml b/crate/bbl/Cargo.toml deleted file mode 100644 index 58803be..0000000 --- a/crate/bbl/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "bbl" -version = "0.1.0" -authors = ["WangRunji "] - -[dependencies] diff --git a/crate/bbl/src/lib.rs b/crate/bbl/src/lib.rs deleted file mode 100644 index a3d70d4..0000000 --- a/crate/bbl/src/lib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![no_std] -#![feature(asm)] - -pub mod sbi; diff --git a/kernel/Cargo.lock b/kernel/Cargo.lock index 7aef963..1363673 100644 --- a/kernel/Cargo.lock +++ b/kernel/Cargo.lock @@ -60,10 +60,6 @@ dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "bbl" -version = "0.1.0" - [[package]] name = "bcm2837" version = "0.1.0" @@ -300,7 +296,6 @@ version = "0.2.0" dependencies = [ "aarch64 2.2.2 (git+https://github.com/rcore-os/aarch64)", "apic 0.1.0 (git+https://github.com/rcore-os/apic-rs)", - "bbl 0.1.0", "bcm2837 0.1.0 (git+https://github.com/rcore-os/bcm2837)", "bit-allocator 0.1.0", "bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index 44b3648..1dd151a 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -67,7 +67,6 @@ pc-keyboard = "0.5" [target.'cfg(any(target_arch = "riscv32", target_arch = "riscv64"))'.dependencies] riscv = { git = "https://github.com/rcore-os/riscv", features = ["inline-asm"] } -bbl = { path = "../crate/bbl" } [target.'cfg(target_arch = "aarch64")'.dependencies] aarch64 = { git = "https://github.com/rcore-os/aarch64" } diff --git a/kernel/src/arch/riscv32/cpu.rs b/kernel/src/arch/riscv32/cpu.rs index 331a82f..fbee91f 100644 --- a/kernel/src/arch/riscv32/cpu.rs +++ b/kernel/src/arch/riscv32/cpu.rs @@ -17,7 +17,7 @@ pub fn id() -> usize { } pub fn send_ipi(cpu_id: usize) { - bbl::sbi::send_ipi(1 << cpu_id); + super::sbi::send_ipi(1 << cpu_id); } pub unsafe fn has_started(cpu_id: usize) -> bool { @@ -37,5 +37,5 @@ pub fn halt() { } pub fn exit_in_qemu(error_code: u8) -> ! { - bbl::sbi::shutdown() + super::sbi::shutdown() } diff --git a/kernel/src/arch/riscv32/interrupt.rs b/kernel/src/arch/riscv32/interrupt.rs index a2a9e4e..17a0d7d 100644 --- a/kernel/src/arch/riscv32/interrupt.rs +++ b/kernel/src/arch/riscv32/interrupt.rs @@ -160,7 +160,7 @@ fn try_process_drivers() -> bool { fn ipi() { debug!("IPI"); - bbl::sbi::clear_ipi(); + super::sbi::clear_ipi(); } /* diff --git a/kernel/src/arch/riscv32/io.rs b/kernel/src/arch/riscv32/io.rs index a6ef9e0..2290d04 100644 --- a/kernel/src/arch/riscv32/io.rs +++ b/kernel/src/arch/riscv32/io.rs @@ -1,5 +1,5 @@ use core::fmt::{Write, Result, Arguments}; -use bbl::sbi; +use super::sbi; struct SerialPort; diff --git a/kernel/src/arch/riscv32/mod.rs b/kernel/src/arch/riscv32/mod.rs index fba7361..32fe897 100644 --- a/kernel/src/arch/riscv32/mod.rs +++ b/kernel/src/arch/riscv32/mod.rs @@ -7,6 +7,8 @@ pub mod compiler_rt; pub mod consts; pub mod cpu; pub mod syscall; +mod sbi; + use log::*; #[no_mangle] diff --git a/crate/bbl/src/sbi.rs b/kernel/src/arch/riscv32/sbi.rs similarity index 100% rename from crate/bbl/src/sbi.rs rename to kernel/src/arch/riscv32/sbi.rs diff --git a/kernel/src/arch/riscv32/timer.rs b/kernel/src/arch/riscv32/timer.rs index d1de02a..a811a46 100644 --- a/kernel/src/arch/riscv32/timer.rs +++ b/kernel/src/arch/riscv32/timer.rs @@ -1,5 +1,5 @@ use riscv::register::*; -use bbl::sbi; +use super::sbi; use log::*; /*