diff --git a/.travis.yml b/.travis.yml index 7924fe6..34ac5d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,7 +53,9 @@ install: before_script: - rustup component add rust-src - (test -x $HOME/.cargo/bin/cargo-xbuild || cargo install cargo-xbuild) - - (test -x $HOME/.cargo/bin/bootimage || cargo install bootimage) + - if [ $ARCH = x86_64 ]; then + (test -x $HOME/.cargo/bin/bootimage || cargo install bootimage); + fi script: - cd kernel && make build arch=$ARCH $OPTS && cd .. diff --git a/crate/memory/Cargo.toml b/crate/memory/Cargo.toml index 3a9dd20..9ea5f71 100644 --- a/crate/memory/Cargo.toml +++ b/crate/memory/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ucore-memory" +name = "rcore-memory" version = "0.1.0" authors = ["WangRunji "] edition = "2018" diff --git a/crate/process/Cargo.toml b/crate/process/Cargo.toml index d882789..29d4995 100644 --- a/crate/process/Cargo.toml +++ b/crate/process/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ucore-process" +name = "rcore-process" version = "0.1.0" authors = ["WangRunji "] edition = "2018" diff --git a/crate/sync/Cargo.toml b/crate/sync/Cargo.toml index 2b9fa6f..dbd421e 100644 --- a/crate/sync/Cargo.toml +++ b/crate/sync/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ucore-sync" +name = "sync-test" version = "0.1.0" authors = ["WangRunji "] diff --git a/kernel/.gitignore b/kernel/.gitignore deleted file mode 100644 index 00ca089..0000000 --- a/kernel/.gitignore +++ /dev/null @@ -1 +0,0 @@ -outdir/ diff --git a/kernel/Cargo.lock b/kernel/Cargo.lock index 3e82880..2ea4fa0 100644 --- a/kernel/Cargo.lock +++ b/kernel/Cargo.lock @@ -203,6 +203,52 @@ dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rcore" +version = "0.1.0" +dependencies = [ + "aarch64 2.2.2 (git+https://github.com/equation314/aarch64)", + "apic 0.1.0 (git+https://github.com/wangrunji0408/APIC-Rust)", + "atags 0.1.0", + "bbl 0.1.0", + "bcm2837 0.1.0", + "bit-allocator 0.1.0", + "bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bootloader 0.3.4 (git+https://github.com/wangrunji0408/bootloader)", + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.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.6 (registry+https://github.com/rust-lang/crates.io-index)", + "once 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "pc-keyboard 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rcore-memory 0.1.0", + "rcore-process 0.1.0", + "riscv 0.3.0 (git+https://github.com/riscv-and-rust-and-decaf/riscv)", + "simple-filesystem 0.1.0 (git+https://github.com/wangrunji0408/SimpleFileSystem-Rust)", + "spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "uart_16550 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "volatile 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "x86_64 0.3.4 (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 = "rcore-memory" +version = "0.1.0" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rcore-process" +version = "0.1.0" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "register" version = "0.2.1" @@ -303,52 +349,6 @@ dependencies = [ "x86_64 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "ucore" -version = "0.1.0" -dependencies = [ - "aarch64 2.2.2 (git+https://github.com/equation314/aarch64)", - "apic 0.1.0 (git+https://github.com/wangrunji0408/APIC-Rust)", - "atags 0.1.0", - "bbl 0.1.0", - "bcm2837 0.1.0", - "bit-allocator 0.1.0", - "bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "bootloader 0.3.4 (git+https://github.com/wangrunji0408/bootloader)", - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.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.6 (registry+https://github.com/rust-lang/crates.io-index)", - "once 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "pc-keyboard 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "riscv 0.3.0 (git+https://github.com/riscv-and-rust-and-decaf/riscv)", - "simple-filesystem 0.1.0 (git+https://github.com/wangrunji0408/SimpleFileSystem-Rust)", - "spin 0.4.10 (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.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "x86_64 0.3.4 (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 = "ucore-memory" -version = "0.1.0" -dependencies = [ - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ucore-process" -version = "0.1.0" -dependencies = [ - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "unicode-width" version = "0.1.5" diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index 9feff44..be10d48 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ucore" +name = "rcore" version = "0.1.0" edition = "2018" authors = [ @@ -44,8 +44,8 @@ volatile = "0.2" linked_list_allocator = "0.6" lazy_static = { version = "1.2", features = ["spin_no_std"] } bit-allocator = { path = "../crate/bit-allocator" } -ucore-memory = { path = "../crate/memory" } -ucore-process = { path = "../crate/process" } +rcore-memory = { path = "../crate/memory" } +rcore-process = { path = "../crate/process" } simple-filesystem = { git = "https://github.com/wangrunji0408/SimpleFileSystem-Rust" } [target.'cfg(target_arch = "x86_64")'.dependencies] @@ -66,8 +66,8 @@ atags = { path = "../crate/atags" } bcm2837 = { path = "../crate/bcm2837", optional = true } [package.metadata.bootimage] -default-target = "x86_64-blog_os.json" -output = "target/x86_64-blog_os/bootimage.bin" +default-target = "targets/x86_64.json" +output = "target/x86_64/bootimage.bin" minimum-image-size = 0 # The minimum output file size (in MiB) # The command invoked on `bootimage run` # (the "{}" will be replaced with the path to the bootable disk image) diff --git a/kernel/Makefile b/kernel/Makefile index 66cee00..a14b5cd 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -28,7 +28,7 @@ smp ?= 4 m_mode ?= target := $(arch) -kernel := target/$(target)/$(mode)/ucore +kernel := target/$(target)/$(mode)/rcore bin := target/$(target)/$(mode)/kernel.bin bootimage := target/$(target)/bootimage.bin bbl_path := $(PWD)/../riscv-pk @@ -149,6 +149,7 @@ objcopy := $(prefix)objcopy cc := $(prefix)gcc as := $(prefix)as gdb := $(prefix)gdb +export CC=$(cc) .PHONY: all clean run build asm doc justrun debug kernel sfsimg install @@ -220,11 +221,11 @@ else ifeq ($(arch), riscv32) @-patch -p0 -N -b \ $(shell rustc --print sysroot)/lib/rustlib/src/rust/src/libcore/sync/atomic.rs \ src/arch/riscv32/atomic.patch - @CC=$(cc) cargo xbuild $(build_args) + @cargo xbuild $(build_args) else ifeq ($(arch), riscv64) @./build-rv64 else ifeq ($(arch), aarch64) - @CC=$(cc) cargo xbuild $(build_args) + @cargo xbuild $(build_args) endif diff --git a/kernel/build-rv64 b/kernel/build-rv64 index 08860f5..6a41e4f 100755 --- a/kernel/build-rv64 +++ b/kernel/build-rv64 @@ -1,10 +1,6 @@ #!/bin/bash # The contents are adopted from xbuild verbose output. -# Output files are in target/${ARCH}-blog_os/debug -# -# Usage: -# Just run -# $ ./run-qemu-script-custom-llc +# Output files are in target/${ARCH}/debug # # By default riscv64 is built. To build for riscv32, # set the environment variable `RV32` to "1" @@ -12,12 +8,10 @@ set -e if [[ ${RV32} = 1 ]]; then TARGET_ARCH=riscv32 - COMPILER_RT_CFLAGS="-march=rv32imac -mabi=ilp32 -O3" - SFSIMG_CFLAGS="-march=rv32ia -mabi=ilp32" + CFLAGS="-march=rv32imac -mabi=ilp32" else TARGET_ARCH=riscv64 - COMPILER_RT_CFLAGS="-march=rv64imac -mabi=lp64 -O3" - SFSIMG_CFLAGS="-march=rv64ia -mabi=lp64" + CFLAGS="-march=rv64imac -mabi=lp64" fi UCORE_USER_IMAGE="../user/img/ucore-${TARGET_ARCH}.img" LLC=$PWD/../tools/llc @@ -101,7 +95,7 @@ fi CNAME=compiler_builtins if ! [[ -f ${OUTDIR}/${CNAME}.o ]] then -rustc --crate-name compiler_builtins $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.2/src/lib.rs \ +rustc --crate-name compiler_builtins $CARGO_PATH/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.3/src/lib.rs \ --color always --crate-type lib --emit=metadata,llvm-bc \ -C opt-level=3 \ -C debuginfo=2 \ @@ -396,10 +390,10 @@ rustc --edition=2018 --crate-name simple_filesystem $CARGO_PATH/git/checkouts/si gen_full_rlib fi -CNAME=ucore_process +CNAME=rcore_process if ! [[ -f ${OUTDIR}/${CNAME}.o ]] then -rustc --edition=2018 --crate-name ucore_process $PWD/../crate/process/src/lib.rs \ +rustc --edition=2018 --crate-name rcore_process $PWD/../crate/process/src/lib.rs \ --color always --crate-type lib --emit=metadata,llvm-bc \ -C opt-level=1 \ -C debuginfo=2 \ @@ -412,10 +406,10 @@ rustc --edition=2018 --crate-name ucore_process $PWD/../crate/process/src/lib.rs gen_full_rlib fi -CNAME=ucore_memory +CNAME=rcore_memory if ! [[ -f ${OUTDIR}/${CNAME}.o ]] then -rustc --edition=2018 --crate-name ucore_memory $PWD/../crate/memory/src/lib.rs \ +rustc --edition=2018 --crate-name rcore_memory $PWD/../crate/memory/src/lib.rs \ --color always --crate-type lib --emit=metadata,llvm-bc \ -C opt-level=1 \ -C debuginfo=2 \ @@ -498,7 +492,7 @@ fi # Hand generate build.rs if ! [[ -f ${OUTDIR}/libatomic_rt.a ]] then -${CC} src/arch/riscv32/compiler_rt.c ${COMPILER_RT_CFLAGS} -O3 -c -o ${OUTDIR}/compiler_rt.o +${CC} src/arch/riscv32/compiler_rt.c ${CFLAGS} -O3 -Wno-builtin-declaration-mismatch -c -o ${OUTDIR}/compiler_rt.o ${AR} r ${OUTDIR}/libatomic_rt.a ${OUTDIR}/compiler_rt.o fi @@ -513,7 +507,7 @@ _user_img_start: .incbin "${UCORE_USER_IMAGE}" _user_img_end: EOF -if ! ${CC} ${OUTDIR}/sfsimg.S ${SFSIMG_CFLAGS} -c -o ${OUTDIR}/sfsimg.o +if ! ${CC} ${OUTDIR}/sfsimg.S ${CFLAGS} -c -o ${OUTDIR}/sfsimg.o then echo "You should manually create sfs image!" exit 1 @@ -524,7 +518,7 @@ fi #make sfsimg -CNAME=ucore +CNAME=rcore #if ! [[ -f ${OUTDIR}/${CNAME}.o ]] #then if [[ ${board} = k210 ]]; then @@ -533,7 +527,7 @@ if [[ ${board} = k210 ]]; then else cp src/arch/riscv32/board/u540/linker.ld src/arch/riscv32/boot/linker64.ld fi -rustc --edition=2018 --crate-name ucore src/lib.rs \ +rustc --edition=2018 --crate-name rcore src/lib.rs \ --color always --crate-type lib --emit=metadata,llvm-bc \ -C opt-level=1 \ -C debuginfo=2 \ @@ -553,8 +547,8 @@ rustc --edition=2018 --crate-name ucore src/lib.rs \ --extern riscv=${OUTDIR}/libriscv.rlib \ --extern simple_filesystem=${OUTDIR}/libsimple_filesystem.rlib \ --extern spin=${OUTDIR}/libspin.rlib \ - --extern ucore_memory=${OUTDIR}/libucore_memory.rlib \ - --extern ucore_process=${OUTDIR}/libucore_process.rlib \ + --extern rcore_memory=${OUTDIR}/librcore_memory.rlib \ + --extern rcore_process=${OUTDIR}/librcore_process.rlib \ --extern volatile=${OUTDIR}/libvolatile.rlib \ --extern xmas_elf=${OUTDIR}/libxmas_elf.rlib \ -L native=${OUTDIR} -l static=sfsimg -l static=atomic_rt @@ -562,13 +556,13 @@ rustc --edition=2018 --crate-name ucore src/lib.rs \ gen_full_rlib #fi -#if ! [[ -f ${OUTDIR}/ucore ]] +#if ! [[ -f ${OUTDIR}/rcore ]] #then if [[ ${board} = k210 ]]; then export LINK_K210='-L native=kendryte' fi echo "rustc crate-type bin to ${TARGET_JSON}" -rustc --edition=2018 --crate-name ucore src/main.rs \ +rustc --edition=2018 --crate-name rcore src/main.rs \ --color always --crate-type bin --emit=link \ -C opt-level=1 \ -C debuginfo=2 \ @@ -587,9 +581,9 @@ rustc --edition=2018 --crate-name ucore src/main.rs \ --extern riscv=${OUTDIR}/libriscv.rlib \ --extern simple_filesystem=${OUTDIR}/libsimple_filesystem.rlib \ --extern spin=${OUTDIR}/libspin.rlib \ - --extern ucore=${OUTDIR}/libucore.rlib \ - --extern ucore_memory=${OUTDIR}/libucore_memory.rlib \ - --extern ucore_process=${OUTDIR}/libucore_process.rlib \ + --extern rcore=${OUTDIR}/librcore.rlib \ + --extern rcore_memory=${OUTDIR}/librcore_memory.rlib \ + --extern rcore_process=${OUTDIR}/librcore_process.rlib \ --extern volatile=${OUTDIR}/libvolatile.rlib \ --extern xmas_elf=${OUTDIR}/libxmas_elf.rlib \ -L native=${OUTDIR} ${LINK_K210} diff --git a/kernel/src/arch/aarch64/memory.rs b/kernel/src/arch/aarch64/memory.rs index 1513950..f4b7cc0 100644 --- a/kernel/src/arch/aarch64/memory.rs +++ b/kernel/src/arch/aarch64/memory.rs @@ -6,7 +6,7 @@ use aarch64::paging::{memory_attribute::*, PhysFrame as Frame}; use aarch64::{addr::*, barrier, regs::*}; use atags::atags::Atags; use log::*; -use ucore_memory::PAGE_SIZE; +use rcore_memory::PAGE_SIZE; /// Memory initialization. pub fn init() { diff --git a/kernel/src/arch/aarch64/paging.rs b/kernel/src/arch/aarch64/paging.rs index 9b01fc8..04e5b36 100644 --- a/kernel/src/arch/aarch64/paging.rs +++ b/kernel/src/arch/aarch64/paging.rs @@ -1,5 +1,5 @@ //! Page table implementations for aarch64. -use ucore_memory::paging::*; +use rcore_memory::paging::*; use aarch64::asm::{tlb_invalidate, tlb_invalidate_all, ttbr_el1_read, ttbr_el1_write}; use aarch64::{PhysAddr, VirtAddr}; use aarch64::paging::{Mapper, PageTable as Aarch64PageTable, PageTableEntry, PageTableFlags as EF, RecursivePageTable}; diff --git a/kernel/src/arch/riscv32/compiler_rt.c b/kernel/src/arch/riscv32/compiler_rt.c index edd6105..8125759 100644 --- a/kernel/src/arch/riscv32/compiler_rt.c +++ b/kernel/src/arch/riscv32/compiler_rt.c @@ -9,8 +9,8 @@ typedef unsigned u32; // K210 doesn't support atomic operation on 0x40000000 (io port) // We have to detect it and move it to 0x80000000 inline u32* fix_ptr32(u32 *ptr) { - return (u32)ptr < 0x80000000? - (u32*)((u32)ptr + 0x40000000): + return ptr < (u32*)0x80000000? + ptr + 0x40000000 / sizeof(u32): ptr; } @@ -79,8 +79,8 @@ typedef unsigned long long u64; // K210 doesn't support atomic operation on 0x40000000 (io port) // We have to detect it and move it to 0x80000000 inline u64* fix_ptr64(u64 *ptr) { - return (u64)ptr < 0x80000000? - (u64*)((u64)ptr + 0x40000000): + return ptr < (u64*)0x80000000? + ptr + 0x40000000 / sizeof(u64): ptr; } diff --git a/kernel/src/arch/riscv32/memory.rs b/kernel/src/arch/riscv32/memory.rs index e59955b..0ebfbdc 100644 --- a/kernel/src/arch/riscv32/memory.rs +++ b/kernel/src/arch/riscv32/memory.rs @@ -1,6 +1,6 @@ use core::mem; use riscv::{addr::*, register::sstatus}; -use ucore_memory::PAGE_SIZE; +use rcore_memory::PAGE_SIZE; use log::*; use crate::memory::{FRAME_ALLOCATOR, init_heap, MemoryAttr, MemorySet, Linear}; use crate::consts::{MEMORY_OFFSET, MEMORY_END, KERN_VA_BASE}; diff --git a/kernel/src/arch/riscv32/mod.rs b/kernel/src/arch/riscv32/mod.rs index b5cd5c7..24d4350 100644 --- a/kernel/src/arch/riscv32/mod.rs +++ b/kernel/src/arch/riscv32/mod.rs @@ -15,8 +15,6 @@ pub extern fn rust_main(hartid: usize, dtb: usize, hart_mask: usize, functions: unsafe { cpu::set_cpu_id(hartid); } if hartid != 0 { - #[cfg(feature = "board_k210")] - loop {} // K210: if not, an assert will fail in spin::RwLock ??? while unsafe { !cpu::has_started(hartid) } { } println!("Hello RISCV! in hart {}, dtb @ {:#x}, functions @ {:#x}", hartid, dtb, functions); others_main(); diff --git a/kernel/src/arch/riscv32/paging.rs b/kernel/src/arch/riscv32/paging.rs index ef5cdf5..41060f6 100644 --- a/kernel/src/arch/riscv32/paging.rs +++ b/kernel/src/arch/riscv32/paging.rs @@ -6,7 +6,7 @@ use riscv::asm::{sfence_vma, sfence_vma_all}; use riscv::paging::{Mapper, PageTable as RvPageTable, PageTableEntry, PageTableFlags as EF, RecursivePageTable}; use riscv::paging::{FrameAllocator, FrameDeallocator}; use riscv::register::satp; -use ucore_memory::paging::*; +use rcore_memory::paging::*; use log::*; #[cfg(target_arch = "riscv32")] use crate::consts::KERNEL_P2_INDEX; diff --git a/kernel/src/arch/x86_64/memory.rs b/kernel/src/arch/x86_64/memory.rs index c9007f4..5184d7a 100644 --- a/kernel/src/arch/x86_64/memory.rs +++ b/kernel/src/arch/x86_64/memory.rs @@ -3,7 +3,7 @@ use crate::consts::KERNEL_OFFSET; // Depends on kernel use crate::memory::{FRAME_ALLOCATOR, init_heap, active_table}; use super::{BootInfo, MemoryRegionType}; -use ucore_memory::paging::*; +use rcore_memory::paging::*; use once::*; use log::*; diff --git a/kernel/src/arch/x86_64/paging.rs b/kernel/src/arch/x86_64/paging.rs index d8c01cf..296fec1 100644 --- a/kernel/src/arch/x86_64/paging.rs +++ b/kernel/src/arch/x86_64/paging.rs @@ -1,6 +1,6 @@ // Depends on kernel use crate::memory::{active_table, alloc_frame, dealloc_frame}; -use ucore_memory::paging::*; +use rcore_memory::paging::*; use x86_64::instructions::tlb; use x86_64::PhysAddr; use x86_64::registers::control::{Cr3, Cr3Flags}; diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 6a9458f..ab18c1c 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -13,7 +13,7 @@ extern crate alloc; pub use crate::process::{processor, new_kernel_context}; -use ucore_process::thread; +use rcore_process::thread; use linked_list_allocator::LockedHeap; #[macro_use] // print! diff --git a/kernel/src/main.rs b/kernel/src/main.rs index b5190fe..d4205aa 100644 --- a/kernel/src/main.rs +++ b/kernel/src/main.rs @@ -3,4 +3,4 @@ #![cfg_attr(test, allow(dead_code, unused_macros, unused_imports))] #[allow(unused_imports)] -use ucore; \ No newline at end of file +use rcore; \ No newline at end of file diff --git a/kernel/src/memory.rs b/kernel/src/memory.rs index 4eb42f2..ce1f577 100644 --- a/kernel/src/memory.rs +++ b/kernel/src/memory.rs @@ -2,9 +2,9 @@ pub use crate::arch::paging::*; use bit_allocator::BitAlloc; use crate::consts::MEMORY_OFFSET; use super::HEAP_ALLOCATOR; -use ucore_memory::*; -use ucore_memory::cow::CowExt; -pub use ucore_memory::memory_set::{MemoryArea, MemoryAttr, handler::*}; +use rcore_memory::*; +use rcore_memory::cow::CowExt; +pub use rcore_memory::memory_set::{MemoryArea, MemoryAttr, handler::*}; use crate::process::{process}; use crate::sync::{SpinNoIrqLock, SpinNoIrq, MutexGuard}; use lazy_static::*; @@ -12,10 +12,10 @@ use log::*; use linked_list_allocator::LockedHeap; #[cfg(not(feature = "no_mmu"))] -pub type MemorySet = ucore_memory::memory_set::MemorySet; +pub type MemorySet = rcore_memory::memory_set::MemorySet; #[cfg(feature = "no_mmu")] -pub type MemorySet = ucore_memory::no_mmu::MemorySet; +pub type MemorySet = rcore_memory::no_mmu::MemorySet; // x86_64 support up to 256M memory #[cfg(target_arch = "x86_64")] @@ -112,7 +112,7 @@ pub static MEMORY_ALLOCATOR: LockedHeap = LockedHeap::empty(); #[derive(Debug, Clone, Copy)] pub struct NoMMUSupportImpl; -impl ucore_memory::no_mmu::NoMMUSupport for NoMMUSupportImpl { +impl rcore_memory::no_mmu::NoMMUSupport for NoMMUSupportImpl { type Alloc = LockedHeap; fn allocator() -> &'static Self::Alloc { &MEMORY_ALLOCATOR @@ -128,7 +128,7 @@ pub fn page_fault_handler(_addr: usize) -> bool { //pub mod test { // pub fn cow() { // use super::*; -// use ucore_memory::cow::test::test_with; +// use rcore_memory::cow::test::test_with; // test_with(&mut active_table()); // } //} diff --git a/kernel/src/process/context.rs b/kernel/src/process/context.rs index d648a10..71f63d5 100644 --- a/kernel/src/process/context.rs +++ b/kernel/src/process/context.rs @@ -3,7 +3,7 @@ use alloc::{boxed::Box, collections::BTreeMap, string::String, sync::Arc, vec::V use log::*; use simple_filesystem::file::File; use spin::Mutex; -use ucore_process::Context; +use rcore_process::Context; use xmas_elf::{ElfFile, header, program::{Flags, Type}}; use crate::arch::interrupt::{Context as ArchContext, TrapFrame}; diff --git a/kernel/src/process/mod.rs b/kernel/src/process/mod.rs index 2f2a4e5..2f59994 100644 --- a/kernel/src/process/mod.rs +++ b/kernel/src/process/mod.rs @@ -1,5 +1,5 @@ pub use self::context::Process; -pub use ucore_process::*; +pub use rcore_process::*; use crate::consts::{MAX_CPU_NUM, MAX_PROCESS_NUM}; use crate::arch::cpu; use alloc::{boxed::Box, sync::Arc}; diff --git a/user/Cargo.lock b/user/Cargo.lock index 46bd04c..a0f951e 100644 --- a/user/Cargo.lock +++ b/user/Cargo.lock @@ -1,11 +1,11 @@ [[package]] -name = "ucore-ulib" +name = "rcore-ulib" version = "0.1.0" [[package]] -name = "ucore-user-programs" +name = "rcore-user-programs" version = "0.1.0" dependencies = [ - "ucore-ulib 0.1.0", + "rcore-ulib 0.1.0", ] diff --git a/user/Cargo.toml b/user/Cargo.toml index 42811de..cdd8ee9 100644 --- a/user/Cargo.toml +++ b/user/Cargo.toml @@ -1,8 +1,8 @@ [package] -name = "ucore-user-programs" +name = "rcore-user-programs" version = "0.1.0" authors = ["Runji Wang "] edition = "2018" [dependencies] -"ucore-ulib" = { path = "ucore-ulib" } \ No newline at end of file +"rcore-ulib" = { path = "rcore-ulib" } \ No newline at end of file diff --git a/user/Makefile b/user/Makefile index 817c0a9..7f42564 100644 --- a/user/Makefile +++ b/user/Makefile @@ -4,7 +4,7 @@ arch ?= riscv32 mode ?= debug rust_src_dir := src/bin -rust_bin_path := target/$(arch)-ucore/$(mode) +rust_bin_path := target/$(arch)-rcore/$(mode) user_rust_bins := $(patsubst $(rust_src_dir)/%.rs, $(rust_bin_path)/%, $(wildcard $(rust_src_dir)/*.rs)) c_src_dir := c_bin_path := @@ -17,7 +17,7 @@ sfsimg := $(build_path)/user-$(arch).img mksfs := mksfs -build_args := --target $(arch)-ucore.json +build_args := --target targets/$(arch)-rcore.json ifeq ($(mode), release) build_args := $(build_args) --release endif diff --git a/user/ucore-ulib/Cargo.toml b/user/rcore-ulib/Cargo.toml similarity index 84% rename from user/ucore-ulib/Cargo.toml rename to user/rcore-ulib/Cargo.toml index 27915b1..ea67902 100644 --- a/user/ucore-ulib/Cargo.toml +++ b/user/rcore-ulib/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ucore-ulib" +name = "rcore-ulib" version = "0.1.0" authors = ["WangRunji "] edition = "2018" diff --git a/user/ucore-ulib/src/io.rs b/user/rcore-ulib/src/io.rs similarity index 100% rename from user/ucore-ulib/src/io.rs rename to user/rcore-ulib/src/io.rs diff --git a/user/ucore-ulib/src/lang_items.rs b/user/rcore-ulib/src/lang_items.rs similarity index 100% rename from user/ucore-ulib/src/lang_items.rs rename to user/rcore-ulib/src/lang_items.rs diff --git a/user/ucore-ulib/src/lib.rs b/user/rcore-ulib/src/lib.rs similarity index 100% rename from user/ucore-ulib/src/lib.rs rename to user/rcore-ulib/src/lib.rs diff --git a/user/ucore-ulib/src/syscall.rs b/user/rcore-ulib/src/syscall.rs similarity index 100% rename from user/ucore-ulib/src/syscall.rs rename to user/rcore-ulib/src/syscall.rs diff --git a/user/src/bin/fantastic_text.rs b/user/src/bin/fantastic_text.rs index 40deec9..f78642d 100644 --- a/user/src/bin/fantastic_text.rs +++ b/user/src/bin/fantastic_text.rs @@ -2,7 +2,7 @@ #![no_main] #[macro_use] -extern crate ucore_ulib; +extern crate rcore_ulib; macro_rules! color_text { ($text:expr, $color:expr) => {{ diff --git a/user/src/bin/hello_rust.rs b/user/src/bin/hello_rust.rs index 72e3040..e60b97e 100644 --- a/user/src/bin/hello_rust.rs +++ b/user/src/bin/hello_rust.rs @@ -2,12 +2,12 @@ #![no_main] #[macro_use] -extern crate ucore_ulib; +extern crate rcore_ulib; // IMPORTANT: Must define main() like this #[no_mangle] pub fn main() { println!("Hello Rust uCore!"); - println!("I am process {}.", ucore_ulib::syscall::sys_getpid()); + println!("I am process {}.", rcore_ulib::syscall::sys_getpid()); println!("hello pass."); } diff --git a/user/src/bin/sh.rs b/user/src/bin/sh.rs index c145be0..4323de0 100644 --- a/user/src/bin/sh.rs +++ b/user/src/bin/sh.rs @@ -2,9 +2,9 @@ #![no_main] #[macro_use] -extern crate ucore_ulib; -use ucore_ulib::io::getc; -use ucore_ulib::syscall::{sys_exec, sys_fork, sys_wait}; +extern crate rcore_ulib; +use rcore_ulib::io::getc; +use rcore_ulib::syscall::{sys_exec, sys_fork, sys_wait}; pub fn get_line(buffer: &mut [u8]) -> usize { let mut pos: usize = 0; diff --git a/user/aarch64-ucore.json b/user/targets/aarch64-rcore.json similarity index 100% rename from user/aarch64-ucore.json rename to user/targets/aarch64-rcore.json diff --git a/user/riscv32-ucore.json b/user/targets/riscv32-rcore.json similarity index 100% rename from user/riscv32-ucore.json rename to user/targets/riscv32-rcore.json diff --git a/user/riscv64-ucore.json b/user/targets/riscv64-rcore.json similarity index 100% rename from user/riscv64-ucore.json rename to user/targets/riscv64-rcore.json diff --git a/user/x86_64-ucore.json b/user/targets/x86_64-rcore.json similarity index 100% rename from user/x86_64-ucore.json rename to user/targets/x86_64-rcore.json diff --git a/user/ucore-ulib/Cargo.lock b/user/ucore-ulib/Cargo.lock deleted file mode 100644 index ea99e3c..0000000 --- a/user/ucore-ulib/Cargo.lock +++ /dev/null @@ -1,4 +0,0 @@ -[[package]] -name = "ucore-ulib" -version = "0.1.0" -