mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-22 08:06:17 +04:00
Fit for newest Rust nightly. x86_64 ok, riscv32 broken.
This commit is contained in:
parent
025d3eba22
commit
b88648ff44
@ -1,6 +1,5 @@
|
||||
#![no_std]
|
||||
#![feature(asm)]
|
||||
#![feature(universal_impl_trait)]
|
||||
|
||||
extern crate bit_field;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
use super::paging::*;
|
||||
use super::*;
|
||||
use alloc::BTreeMap;
|
||||
use alloc::collections::BTreeMap;
|
||||
use core::ops::{Deref, DerefMut};
|
||||
|
||||
/// Wrapper for page table, supporting shared map & copy-on-write
|
||||
|
@ -1,7 +1,5 @@
|
||||
#![no_std]
|
||||
#![feature(alloc)]
|
||||
#![feature(universal_impl_trait, conservative_impl_trait)]
|
||||
#![feature(match_default_bindings)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use alloc::vec_deque::VecDeque;
|
||||
use alloc::collections::VecDeque;
|
||||
use super::*;
|
||||
use paging::Entry;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use alloc::vec_deque::VecDeque;
|
||||
use alloc::collections::VecDeque;
|
||||
use super::*;
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -4,4 +4,4 @@ version = "0.1.0"
|
||||
authors = ["WangRunji <wangrunji0408@163.com>"]
|
||||
|
||||
[dependencies]
|
||||
log = { git = "https://github.com/riscv-and-rust-and-decaf/log.git" }
|
||||
log = "0.4"
|
||||
|
@ -1,4 +1,4 @@
|
||||
use alloc::BinaryHeap;
|
||||
use alloc::collections::BinaryHeap;
|
||||
use core::cmp::{Ordering, PartialOrd};
|
||||
|
||||
type Time = usize;
|
||||
|
@ -1,8 +1,6 @@
|
||||
#![no_std]
|
||||
#![feature(alloc)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(linkage)]
|
||||
#![feature(universal_impl_trait, conservative_impl_trait)]
|
||||
|
||||
extern crate alloc;
|
||||
#[macro_use]
|
||||
|
@ -1,4 +1,4 @@
|
||||
use alloc::{boxed::Box, BTreeMap};
|
||||
use alloc::{boxed::Box, collections::BTreeMap};
|
||||
use scheduler::*;
|
||||
use event_hub::EventHub;
|
||||
use util::GetMut2;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use alloc::{BinaryHeap, Vec};
|
||||
use alloc::{collections::BinaryHeap, vec::Vec};
|
||||
|
||||
type Pid = usize;
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
//! ```
|
||||
|
||||
use alloc::boxed::Box;
|
||||
use alloc::BTreeMap;
|
||||
use alloc::collections::BTreeMap;
|
||||
use core::any::Any;
|
||||
use core::marker::PhantomData;
|
||||
use core::ptr;
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 590eb508d4ddc503bf7220b8ec78a291129af4ef
|
||||
Subproject commit ed6e4c5b935d9d027303da829a7508c105df3139
|
56
kernel/Cargo.lock
generated
56
kernel/Cargo.lock
generated
@ -14,18 +14,10 @@ dependencies = [
|
||||
"bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit-set"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bit-vec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit-vec"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
source = "git+https://github.com/AltSysrq/bit-vec.git#9861a58d6e761906cc63964c759e71f05bf63540"
|
||||
|
||||
[[package]]
|
||||
name = "bit_field"
|
||||
@ -55,14 +47,6 @@ dependencies = [
|
||||
"spin 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linked_list_allocator"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"spin 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linked_list_allocator"
|
||||
version = "0.6.3"
|
||||
@ -74,14 +58,14 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.3"
|
||||
source = "git+https://github.com/riscv-and-rust-and-decaf/log.git#726fc46eba8960e3630b28af1a3e27b1d9df7b01"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multiboot2"
|
||||
version = "0.6.0"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -111,11 +95,6 @@ dependencies = [
|
||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rlibc"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rust-ucore"
|
||||
version = "0.1.0"
|
||||
@ -126,30 +105,28 @@ dependencies = [
|
||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"linked_list_allocator 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"linked_list_allocator 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.3 (git+https://github.com/riscv-and-rust-and-decaf/log.git)",
|
||||
"multiboot2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"multiboot2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"once 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"riscv 0.2.0",
|
||||
"rlibc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"simple-filesystem 0.0.1 (git+https://github.com/wangrunji0408/SimpleFileSystem-Rust)",
|
||||
"spin 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uart_16550 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ucore-memory 0.1.0",
|
||||
"ucore-process 0.1.0",
|
||||
"volatile 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"x86_64 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"x86_64 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xmas-elf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simple-filesystem"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/wangrunji0408/SimpleFileSystem-Rust#7251ab7fb70f88172b31e3f38322b5ab81bca74b"
|
||||
source = "git+https://github.com/wangrunji0408/SimpleFileSystem-Rust#ca10d11264c85932e95e6c7c29e8b10c91ae0720"
|
||||
dependencies = [
|
||||
"bit-set 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bit-vec 0.5.0 (git+https://github.com/AltSysrq/bit-vec.git)",
|
||||
"static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -169,7 +146,7 @@ version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"x86_64 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"x86_64 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -180,7 +157,7 @@ version = "0.1.0"
|
||||
name = "ucore-process"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"log 0.4.3 (git+https://github.com/riscv-and-rust-and-decaf/log.git)",
|
||||
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -200,7 +177,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "x86_64"
|
||||
version = "0.2.8"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -225,21 +202,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum bare-metal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eda0f54b2d49f18f3867a5e6d458299bb886db6e64c34d319d6b1aa0839ac31c"
|
||||
"checksum bit-set 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6f1efcc46c18245a69c38fcc5cc650f16d3a59d034f3106e9ed63748f695730a"
|
||||
"checksum bit-vec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4440d5cb623bb7390ae27fec0bb6c61111969860f8e3ae198bfa0663645e67cf"
|
||||
"checksum bit-vec 0.5.0 (git+https://github.com/AltSysrq/bit-vec.git)" = "<none>"
|
||||
"checksum bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed8765909f9009617974ab6b7d332625b320b33c326b1e9321382ef1999b5d56"
|
||||
"checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789"
|
||||
"checksum cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "2119ea4867bd2b8ed3aecab467709720b2d55b1bcfe09f772fd68066eaf15275"
|
||||
"checksum cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efe5c877e17a9c717a0bf3613b2709f723202c4e4675cc8f12926ded29bcb17e"
|
||||
"checksum lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fb497c35d362b6a331cfd94956a07fc2c78a4604cdbee844a81170386b996dd3"
|
||||
"checksum linked_list_allocator 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6420a3167cee611c9d0f53663c339e85058bf05234e9862a47bf56920db8542"
|
||||
"checksum linked_list_allocator 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "655d57c71827fe0891ce72231b6aa5e14033dae3f604609e6a6f807267c1678d"
|
||||
"checksum log 0.4.3 (git+https://github.com/riscv-and-rust-and-decaf/log.git)" = "<none>"
|
||||
"checksum multiboot2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc447d7e888cd9ae093fb7a9117411c85e7c799afd69d0fff64bf47332bb91f7"
|
||||
"checksum log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "61bd98ae7f7b754bc53dca7d44b604f733c6bba044ea6f41bc8d89272d8161d2"
|
||||
"checksum multiboot2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6ebbe89ab663a65cab341428d5fc7013b0eab5543ace92a401a86581e50fdd81"
|
||||
"checksum once 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "931fb7a4cf34610cf6cbe58d52a8ca5ef4c726d4e2e178abd0dc13a6551c6d73"
|
||||
"checksum os_bootinfo 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "66481dbeb5e773e7bd85b63cd6042c30786f834338288c5ec4f3742673db360a"
|
||||
"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1"
|
||||
"checksum rlibc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe"
|
||||
"checksum simple-filesystem 0.0.1 (git+https://github.com/wangrunji0408/SimpleFileSystem-Rust)" = "<none>"
|
||||
"checksum spin 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14db77c5b914df6d6173dda9a3b3f5937bd802934fa5edaf934df06a3491e56f"
|
||||
"checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5"
|
||||
@ -247,6 +221,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum usize_conversions 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f70329e2cbe45d6c97a5112daad40c34cd9a4e18edb5a2a18fefeb584d8d25e5"
|
||||
"checksum ux 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53d8df5dd8d07fedccd202de1887d94481fadaea3db70479f459e8163a1fab41"
|
||||
"checksum volatile 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37c5d76c0f40ba4f8ac10ec4717d4e98ce3e58c5607eea36e9464226fc5e0a95"
|
||||
"checksum x86_64 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "51b347fd81faca2e19366605a2bb52aa2f0e1572835678e3355b66aab18650e6"
|
||||
"checksum x86_64 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "466c2002e38edde7ebbaae6656793d4f71596634971c7e8cbf7afa4827968445"
|
||||
"checksum xmas-elf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "22678df5df766e8d1e5d609da69f0c3132d794edf6ab5e75e7abcd2270d4cf58"
|
||||
"checksum zero 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5f1bc8a6b2005884962297587045002d8cfb8dcec9db332f4ca216ddc5de82c5"
|
||||
|
@ -8,15 +8,10 @@ crate-type = ["staticlib"]
|
||||
|
||||
[features]
|
||||
use_apic = []
|
||||
test = []
|
||||
qemu_auto_exit = []
|
||||
link_user_program = []
|
||||
|
||||
[profile.dev]
|
||||
# MUST >= 1 : Enable RVO to avoid stack overflow
|
||||
# MUST >= 2 : Avoid (u8, u8) LLVM error in RV32 (at crate 'log')
|
||||
# Error: Assertion `isSimple() && "Expected a SimpleValueType!"' failed.
|
||||
# BUT!
|
||||
# MUST <= 1 : Avoid double fault at -O2 T_T
|
||||
opt-level = 1
|
||||
|
||||
@ -24,30 +19,27 @@ opt-level = 1
|
||||
debug = true
|
||||
|
||||
[dependencies]
|
||||
# Fixed version for RV32
|
||||
log = { git = "https://github.com/riscv-and-rust-and-decaf/log.git" }
|
||||
rlibc = "1.0"
|
||||
log = "0.4"
|
||||
spin = "0.4.8"
|
||||
once = "0.3.3"
|
||||
xmas-elf = "0.6"
|
||||
bitflags = "1.0"
|
||||
bit_field = "0.9.0"
|
||||
volatile = "0.1.0"
|
||||
linked_list_allocator = "0.6"
|
||||
lazy_static = { version = "1.0.0", features = ["spin_no_std"] }
|
||||
bit-allocator = { path = "../crate/bit-allocator" }
|
||||
ucore-memory = { path = "../crate/memory" }
|
||||
ucore-process = { path = "../crate/process" }
|
||||
simple-filesystem = { git = "https://github.com/wangrunji0408/SimpleFileSystem-Rust" }
|
||||
|
||||
[target.x86_64-blog_os.dependencies]
|
||||
multiboot2 = "0.6"
|
||||
x86_64 = "0.2.6"
|
||||
linked_list_allocator = "0.6"
|
||||
[target.'cfg(target_arch = "x86_64")'.dependencies]
|
||||
multiboot2 = "0.7"
|
||||
x86_64 = "0.2.11"
|
||||
redox_syscall = "0.1"
|
||||
uart_16550 = "0.1"
|
||||
|
||||
[target.riscv32-blog_os.dependencies]
|
||||
linked_list_allocator = "0.5" # due to rust version
|
||||
[target.'cfg(target_arch = "riscv32")'.dependencies]
|
||||
riscv = { path = "../crate/riscv" }
|
||||
bbl = { path = "../crate/bbl" }
|
||||
|
||||
|
@ -63,7 +63,7 @@ ifdef int
|
||||
qemu_opts := $(qemu_opts) -d int
|
||||
endif
|
||||
|
||||
build_args := --target $(target) --features "$(features)"
|
||||
build_args := --target $(target).json --features "$(features)"
|
||||
|
||||
ifeq ($(mode), release)
|
||||
build_args := $(build_args) --release
|
||||
@ -141,7 +141,7 @@ $(kernel): kernel $(assembly_object_files) $(linker_script)
|
||||
$(assembly_object_files) $(rust_lib)
|
||||
|
||||
kernel:
|
||||
@RUST_TARGET_PATH=$(shell pwd) CC=$(cc) xargo build $(build_args)
|
||||
@CC=$(cc) cargo xbuild $(build_args)
|
||||
|
||||
# compile assembly files
|
||||
build/x86_64/boot/%.o: $(boot_src)/%.asm
|
||||
|
@ -1,6 +0,0 @@
|
||||
[dependencies]
|
||||
alloc = {}
|
||||
|
||||
[target.riscv32-blog_os.dependencies.compiler_builtins]
|
||||
features = ["mem"]
|
||||
stage = 1
|
@ -4,7 +4,7 @@ use std::fs::File;
|
||||
use std::io::{Write, Result};
|
||||
|
||||
fn main() {
|
||||
if std::env::var("TARGET").unwrap().starts_with("x86_64") {
|
||||
if std::env::var("TARGET").unwrap().find("x86_64").is_some() {
|
||||
cc::Build::new()
|
||||
.file("src/arch/x86_64/driver/apic/lapic.c")
|
||||
.file("src/arch/x86_64/driver/keyboard/keyboard.c")
|
||||
|
@ -5,7 +5,7 @@
|
||||
"target-pointer-width": "32",
|
||||
"target-c-int-width": "32",
|
||||
"os": "none",
|
||||
"arch": "riscv",
|
||||
"arch": "riscv32",
|
||||
"cpu": "generic-rv32",
|
||||
"features": "+m",
|
||||
"max-atomic-width": "32",
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
#[inline]
|
||||
-unsafe fn atomic_compare_exchange<T>(dst: *mut T,
|
||||
+#[cfg(target_arch = "riscv")]
|
||||
+#[cfg(target_arch = "riscv32")]
|
||||
+unsafe fn atomic_compare_exchange<T: PartialEq>(dst: *mut T,
|
||||
old: T,
|
||||
new: T,
|
||||
|
@ -25,7 +25,7 @@ fn init_frame_allocator(boot_info: &BootInformation) {
|
||||
|
||||
let mut ba = FRAME_ALLOCATOR.lock();
|
||||
for area in memory_areas {
|
||||
ba.insert(to_range(area.start_address(), area.end_address()));
|
||||
ba.insert(to_range(area.start_address() as usize, area.end_address() as usize));
|
||||
}
|
||||
for section in elf_sections {
|
||||
ba.remove(to_range(section.start_address() as usize, section.end_address() as usize));
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[cfg(target_arch = "riscv")]
|
||||
#[cfg(target_arch = "riscv32")]
|
||||
pub use self::riscv::*;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub use self::x86_64::*;
|
||||
@ -8,7 +8,7 @@ pub use self::x86_64::*;
|
||||
pub const MAX_CPU_NUM: usize = 8;
|
||||
pub const MAX_PROCESS_NUM: usize = 48;
|
||||
|
||||
#[cfg(target_arch = "riscv")]
|
||||
#[cfg(target_arch = "riscv32")]
|
||||
mod riscv {
|
||||
// Physical address available on THINPAD:
|
||||
// [0x80000000, 0x80800000]
|
||||
|
@ -5,7 +5,7 @@ use arch::driver::ide;
|
||||
use spin::Mutex;
|
||||
|
||||
pub fn shell() {
|
||||
#[cfg(target_arch = "riscv")]
|
||||
#[cfg(target_arch = "riscv32")]
|
||||
let device = {
|
||||
extern {
|
||||
fn _binary_user_riscv_img_start();
|
||||
|
@ -1,37 +1,23 @@
|
||||
// Rust language features implementions
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
use core::alloc::Layout;
|
||||
|
||||
#[lang = "eh_personality"]
|
||||
extern fn eh_personality() {
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[panic_implementation]
|
||||
#[no_mangle]
|
||||
pub fn panic(info: &PanicInfo) -> ! {
|
||||
let location = info.location().unwrap();
|
||||
let message = info.message().unwrap();
|
||||
error!("\n\nPANIC in {} at line {}\n {}", location.file(), location.line(), message);
|
||||
if cfg!(feature = "qemu_auto_exit") {
|
||||
use arch::cpu;
|
||||
unsafe{ cpu::exit_in_qemu(3) }
|
||||
} else {
|
||||
loop { }
|
||||
}
|
||||
loop { }
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "riscv")]
|
||||
#[lang = "panic_fmt"]
|
||||
#[no_mangle]
|
||||
pub fn panic_fmt(fmt: ::core::fmt::Arguments, file: &'static str, line: u32, col: u32) -> ! {
|
||||
error!("\n\nPANIC in {} at {}:{}\n {}", file, line, col, fmt);
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[lang = "oom"]
|
||||
#[no_mangle]
|
||||
pub fn oom() -> ! {
|
||||
pub fn oom(_: Layout) -> ! {
|
||||
panic!("out of memory");
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
#![feature(const_unique_new, const_atomic_usize_new)]
|
||||
#![feature(unique)]
|
||||
#![feature(allocator_api)]
|
||||
#![feature(global_allocator)]
|
||||
#![feature(abi_x86_interrupt)]
|
||||
#![feature(iterator_step_by)]
|
||||
#![feature(unboxed_closures)]
|
||||
@ -14,7 +13,6 @@
|
||||
#![feature(optin_builtin_traits)]
|
||||
#![feature(panic_implementation)]
|
||||
#![feature(panic_info_message)]
|
||||
#![feature(universal_impl_trait)]
|
||||
#![feature(global_asm)]
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![no_std]
|
||||
@ -33,16 +31,11 @@ extern crate linked_list_allocator;
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate once;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
extern crate rlibc;
|
||||
#[cfg(target_arch = "riscv")]
|
||||
extern crate compiler_builtins;
|
||||
extern crate simple_filesystem;
|
||||
extern crate spin;
|
||||
extern crate ucore_memory;
|
||||
extern crate ucore_process;
|
||||
extern crate volatile;
|
||||
#[macro_use]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
extern crate x86_64;
|
||||
extern crate xmas_elf;
|
||||
@ -75,7 +68,7 @@ mod console;
|
||||
#[path = "arch/x86_64/mod.rs"]
|
||||
mod arch;
|
||||
|
||||
#[cfg(target_arch = "riscv")]
|
||||
#[cfg(target_arch = "riscv32")]
|
||||
#[path = "arch/riscv32/mod.rs"]
|
||||
mod arch;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use alloc::VecDeque;
|
||||
use alloc::collections::VecDeque;
|
||||
use super::*;
|
||||
use thread;
|
||||
use thread_;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use alloc::{arc::Arc, arc::Weak, VecDeque};
|
||||
use alloc::{sync::Arc, sync::Weak, collections::VecDeque};
|
||||
use super::Condvar;
|
||||
use super::SpinLock as Mutex;
|
||||
|
||||
|
@ -215,7 +215,7 @@ impl MutexSupport for Spin {
|
||||
unsafe {
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
asm!("pause" :::: "volatile");
|
||||
#[cfg(target_arch = "riscv")]
|
||||
#[cfg(target_arch = "riscv32")]
|
||||
asm!("nop" :::: "volatile");
|
||||
}
|
||||
}
|
||||
@ -245,7 +245,7 @@ impl MutexSupport for SpinNoIrq {
|
||||
unsafe {
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
asm!("pause" :::: "volatile");
|
||||
#[cfg(target_arch = "riscv")]
|
||||
#[cfg(target_arch = "riscv32")]
|
||||
asm!("nop" :::: "volatile");
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
//!
|
||||
//! The code is borrowed from [RustDoc - Dining Philosophers](https://doc.rust-lang.org/1.6.0/book/dining-philosophers.html)
|
||||
|
||||
use alloc::{arc::Arc, Vec};
|
||||
use alloc::{sync::Arc, vec::Vec};
|
||||
use core::time::Duration;
|
||||
use sync::Condvar;
|
||||
use sync::ThreadLock as Mutex;
|
||||
|
@ -25,7 +25,7 @@ fn panic(info: &::core::panic::PanicInfo) -> ! {
|
||||
sys_exit(1)
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "riscv")]
|
||||
#[cfg(target_arch = "riscv32")]
|
||||
#[lang = "panic_fmt"]
|
||||
#[no_mangle]
|
||||
pub fn panic_fmt(fmt: ::core::fmt::Arguments, file: &'static str, line: u32, col: u32) -> ! {
|
||||
|
@ -32,7 +32,7 @@ impl fmt::Write for StdOut {
|
||||
fn sys_call(id: usize, arg0: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) -> i32 {
|
||||
let ret: i32;
|
||||
unsafe {
|
||||
#[cfg(target_arch = "riscv")]
|
||||
#[cfg(target_arch = "riscv32")]
|
||||
asm!("ecall"
|
||||
: "={x10}" (ret)
|
||||
: "{x10}" (id), "{x11}" (arg0), "{x12}" (arg1), "{x13}" (arg2), "{x14}" (arg3), "{x15}" (arg4), "{x16}" (arg5)
|
||||
|
Loading…
Reference in New Issue
Block a user