Git Product home page Git Product logo

rcore's Introduction

rCore

CI

NO LONGER MAINTAINED. You can see recent developments in:

Rust version of THU uCore OS Plus.

Going to be the next generation teaching operating system.

Supported architectures and boards:

  • x86_64(Tier 1): QEMU, PC (i5/i7)
  • RISCV32/64(Tier 2): QEMU, HiFive Unleashed
  • AArch64(Tier 2): QEMU, Raspberry Pi 3B+
  • MIPS32(Tier 3): QEMU, TrivialMIPS

demo

What's included

rCore has the following features:

  • Linux compatible syscall interface: run Linux userspace programs
  • Network stack
  • Simple file system
  • Signal system
  • Async IO
  • Kernel module

Building

Environment

Setup on Linux or macOS:

$ rustup component add rust-src llvm-tools-preview

Or use Docker container:

$ docker run -it -v $PWD:$PWD -w $PWD wangrunji0408/rcore

How to run

$ git clone https://github.com/rcore-os/rCore.git --recursive
$ cd rCore/user
$ make sfsimg PREBUILT=1 ARCH=x86_64
$ cd ../kernel
$ make run ARCH=x86_64 LOG=info

See Makefile for more usages.

Maintainers

Module Maintainer
x86_64 @wangrunji0408
RISC-V @jiegec
AArch64 (Raspi3) @equation314
MIPS @Harry_Chen @miskcoo
Memory, Process, File System @wangrunji0408
Network with drivers @jiegec
GUI @equation314

History

This is a project of THU courses:

Reports and Dev docs (in Chinese)

It's based on BlogOS , a demo project in the excellent tutorial Writing an OS in Rust (First Edition).

License

The source code is dual-licensed under MIT or the Apache License (Version 2.0).

rcore's People

Contributors

benjaminpmlovegood avatar benpigchu avatar cfgbd avatar chenqiuhao1997 avatar chyyuu avatar circuitcoder avatar eatenbagpipe avatar equation314 avatar gjz010 avatar harry-chen avatar hoblovski avatar jackey-huo avatar jiegec avatar koumingyang avatar lcy1996 avatar loremkang avatar maoyuchaxue avatar miskcoo avatar naginikaido avatar panql avatar phil-opp avatar prettykernel avatar songzhi avatar ssryps avatar universuen avatar wangrunji0408 avatar wfly1998 avatar xy-plus avatar xyongcn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rcore's Issues

K210 Dev Kit support

Can Sipeed Maixduino Kit run this? Any document about build and installation?

编译riscv64版内核出错

编译所用的命令:

git submodule update --init --recursive
cd user
make sfsimg PREBUILT=1 ARCH=riscv64
cd ../kernel
make run ARCH=riscv64 LOG=info

输出如下信息:
Building riscv64 kernel
patching file /home/szx/.rustup/toolchains/nightly-2020-06-04-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/sync/atomic.rs
Reversed (or previously applied) patch detected! Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file /home/szx/.rustup/toolchains/nightly-2020-06-04-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/sync/atomic.rs.rej
Makefile:301: recipe for target 'kernel' failed
make: [kernel] Error 1 (ignored)
Downloaded memchr v2.3.3 (registry https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git)
/* 忽略中间部分 */
Compiling buddy_system_allocator v0.4.0
warning: use of deprecated item 'sync::condvar::Condvar::_wait': this may leads to lost wakeup problem. please use wait instead.
--> src/sync/mutex.rs:314:14
|
314 | self._wait();
| ^^^^^
|
= note: #[warn(deprecated)] on by default

warning: unreachable pattern
--> src/lkm/manager.rs:466:13
|
466 | loader::REL_OFFSET32 => {
| ^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unreachable_patterns)] on by default

warning: unreachable pattern
--> src/lkm/manager.rs:473:13
|
473 | loader::REL_GOT => unsafe {
| ^^^^^^^^^^^^^^^

warning: 3 warnings emitted

Finished release [optimized] target(s) in 46.70s

target/riscv64/release/rcore: 1: target/riscv64/release/rcore: Syntax error: ")" unexpected
Makefile:292: recipe for target 'target/riscv64/release/kernel.img' failed
make: *** [target/riscv64/release/kernel.img] Error 2

用户程序的问题

事实上这是 oscourse/RustOS 的 issue, 但是 owner 没有开 issue.

有如下问题:

  1. forktest, forktree 等输出乱序
  2. softint 错误
  3. badarg 错误
  4. pgdir 错误

Fail to run RustOS.

I was following the instructions in README.md of 0c9679b.

I was successful before executing make build inside docker, which gives me an error message like

root@f4cb6008d280:/home/hob/Programs/RustOS/kernel# make build
   Compiling core v0.0.0 (file:///rust/rust-riscv-rust-1.26.0-1-dev/src/libcore)
   Compiling std_unicode v0.0.0 (file:///rust/rust-riscv-rust-1.26.0-1-dev/src/libstd_unicode)
   Compiling alloc v0.0.0 (file:///rust/rust-riscv-rust-1.26.0-1-dev/src/liballoc)
    Finished release [optimized + debuginfo] target(s) in 41.40 secs
   Compiling compiler_builtins v0.1.0 (file:///rust/rust-riscv-rust-1.26.0-1-dev/src/libcompiler_builtins)
    Finished release [optimized + debuginfo] target(s) in 4.29 secs
error: failed to load source for a dependency on `bit-allocator`

Caused by:
  Unable to update file:///home/hob/Programs/RustOS/crate/bit-allocator

Caused by:
  failed to read `/home/hob/Programs/RustOS/crate/bit-allocator/Cargo.toml`

Caused by:
  No such file or directory (os error 2)
Makefile:144: recipe for target 'kernel' failed
make: *** [kernel] Error 101

Inside docker, RustOS/ has only one entry kernel/, no crate/.

root@f4cb6008d280:/home/hob/Programs# ls RustOS/
kernel

Have I got anywhere wrong?

`busybox ls` crashed on RISCV32/64

Environment

macOS Catalina 10.15.3
rCore master c1907b6
rCore-user v0.1.4 rcore-os/rcore-user@561fa17
rustc 1.42.0-nightly (488406183 2020-01-16)
cargo 1.42.0-nightly (ad3dbe10e 2020-01-13)
QEMU 4.2.0

RISCV32

$ make ARCH=riscv32 LOG=error run
/ # /busybox ls
[ERROR][0,1] TrapFrame {
    regs: {
        "zero": 0x0,
        "ra": 0x6577a,
        "sp": 0x3ffffe70,
        "gp": 0xc59c0,
        "tp": 0xc62a8,
        "t0": 0x0,
        "t1": 0xff800000,
        "t2": 0x63,
        "s0": 0x1,
        "s1": 0x0,
        "a0": 0x1010,
        "a1": 0xfff,
        "a2": 0x0,
        "a3": 0x0,
        "a4": 0x0,
        "a5": 0x0,
        "a6": 0x8,
        "a7": 0x4f,
        "s2": 0x4,
        "s3": 0xc6000,
        "s4": 0x1010,
        "s5": 0x1128,
        "s6": 0x0,
        "s7": 0x0,
        "s8": 0x0,
        "s9": 0x0,
        "s10": 0x0,
        "s11": 0x0,
        "t3": 0x3d,
        "t4": 0x2b,
        "t5": 0x2,
        "t6": 0x1,
    },
    sstatus: Sstatus {
        bits: 0x80046020,
    },
    sepc: 0x65786,
    stval: 0x4,
    scause: Exception(
        LoadPageFault,
    ),
}
/ #

RISCV64

$ make ARCH=riscv32 LOG=error run
/ # /busybox ls
[ERROR][0,1] TrapFrame {
    regs: {
        "zero": 0x0,
        "ra": 0x13c0,
        "sp": 0x3ffff930,
        "gp": 0x10cad8,
        "tp": 0x10dc08,
        "t0": 0x3f,
        "t1": 0x139a,
        "t2": 0x86,
        "s0": 0x2940,
        "s1": 0x2940,
        "a0": 0x0,
        "a1": 0x3ffff8a0,
        "a2": 0x0,
        "a3": 0x8,
        "a4": 0x800,
        "a5": 0x10e140,
        "a6": 0xe8260,
        "a7": 0x87,
        "s2": 0x13c0,
        "s3": 0x13c0,
        "s4": 0x105548,
        "s5": 0x1020,
        "s6": 0xffffffffffffffff,
        "s7": 0x10e000,
        "s8": 0x0,
        "s9": 0xe8220,
        "s10": 0x1400,
        "s11": 0x105548,
        "t3": 0x9,
        "t4": 0x60,
        "t5": 0xff,
        "t6": 0x88,
    },
    sstatus: Sstatus {
        bits: 0x8000000000046020,
    },
    sepc: 0x13c0,
    stval: 0x13c0,
    scause: Exception(
        InstructionPageFault,
    ),
}
/ #

waitpid implementation difference between ucore and rcore

Description

Discovered by testing ucore test badarg.

In uCore, when waitpid succeeds, it returns 0.

But in rCore, when waitpid succeeds, it returns the pid of the process that changes it status.

In test badarg, it asserts that "waitpid(-1, exit_code) == 0" (which corresponds to the standard of uCore), but in rCore the return value is 2 (the pid of the child process that exits).

Reproduce Steps

make sfsimg arch=x86_64
make run arch=x86_64 mode=release
cd ucore
./badarg

Current Result

fork ok.
user panic at /home/huangbj16/Documents/ostrain/rCore_Self/rCore/user/ucore/src/badarg.c:21:
    assertion failed: waitpid(pid, &exit_code) == 0 && exit_code == 0xbeaf
Unknown signal (core dumped)

#Expected Result

A deadlock occurred while using a user network program

A deadlock occurred while using a user network program

Run network command in the rCore:

/busybox nc -l -p 8080

Deadlock detected! locked by cpu 0 thread 0

The error log as follow:

[ WARN][0,-] 0:2:2 syscall id 54, args:[3, 1, 2, 140737488354604, 4, 0] 
[ INFO][0,-] setsockopt: fd: 3, level: 1, optname: 2
[ WARN][0,-] setsockopt is unimplemented
[ INFO][0,-] => Ok(0)
[ WARN][0,-] 0:2:2 syscall id 49, args:[3, 20836, 16, 0, 0, 0] 
[ INFO][0,-] sys_bind: fd: 3 addr: 0x5164 len: 16
[ INFO][0,-] sys_bind: fd: 3 bind to Ip(Endpoint { addr: Ipv4(Address([0, 0, 0, 0])), port: 8080 })
[ INFO][0,-] => Ok(0)
[ INFO][0,-] page fault from user @ 0x42ce4e
[DEBUG][0,-] file handle page fault, and fill data 
[ INFO][0,-] page fault from user @ 0x4c0114
[DEBUG][0,-] file handle page fault, and fill data 
[ INFO][0,-] thread 2 yield_now
[ WARN][0,-] 0:2:2 syscall id 50, args:[3, 1, 0, 0, 0, 0] 
[ INFO][0,-] sys_listen: fd: 3 backlog: 1
[ INFO][0,-] socket listening on Endpoint { addr: Ipv4(Address([0, 0, 0, 0])), port: 8080 }
[ INFO][0,-] => Ok(0)
[ WARN][0,-] 0:2:2 syscall id 13, args:[14, 140737488354032, 140737488354064, 8, 14, 0] 
[ INFO][0,-] rt_sigaction: signum: SIGALRM, act: 0x7ffffffffaf0, oldact: 0x7ffffffffb10, sigsetsize: 8
[ INFO][0,-] new action: SIGALRM -> signal action { handler: 42cd92, mask: Sigset(0), flags: RESTART | RESTORER, restorer: 4c9140 }
[ INFO][0,-] => Ok(0)
[ WARN][0,-] 0:2:2 syscall id 38, args:[0, 140737488354416, 140737488354416, 8, 8, 0] 
[ WARN][0,-] setitimer is unimplemented
[ INFO][0,-] => Ok(0)
[ INFO][0,-] page fault from user @ 0x4ce340
[DEBUG][0,-] file handle page fault, and fill data 
[ WARN][0,-] 0:2:2 syscall id 43, args:[3, 4188, 4184, 0, 0, 0] 
[ INFO][0,-] sys_accept: fd: 3 addr: 0x105c addr_len: 0x1058
[ERROR][0,-] Mutex: deadlock detected! locked by cpu 0 thread 0 @ 0xffffff0002d86280
[ERROR][0,-] 

panicked at 'attempt to add with overflow', src/sync/mutex.rs:105:17
=== BEGIN rCore stack trace ===
#00 PC: 0xFFFFFF000020FE9B FP: 0xFFFFFF01001FF5A0
#01 PC: 0xFFFFFF000022C767 FP: 0xFFFFFF01001FF600
#02 PC: 0xFFFFFF000022C6BF FP: 0xFFFFFF01001FF630
#03 PC: 0xFFFFFF00000BB7D0 FP: 0xFFFFFF01001FF680
#04 PC: 0xFFFFFF00000DA0DD FP: 0xFFFFFF01001FF740
#05 PC: 0xFFFFFF0000126744 FP: 0xFFFFFF01001FFA20
#06 PC: 0xFFFFFF00000FCB71 FP: 0xFFFFFF01001FFB90
#07 PC: 0xFFFFFF00000FA500 FP: 0xFFFFFF01001FFD30
#08 PC: 0xFFFFFF00000F5D2E FP: 0xFFFFFF01001FFDE0
#09 PC: 0xFFFFFF0000175AB6 FP: 0xFFFFFF01001FFED0
#10 PC: 0xFFFFFF00000B48FD FP: 0xFFFFFF01001FFF30
#11 PC: 0xFFFFFF00002353F9 FP: 0xFFFFFF01001FFF40
=== END rCore stack trace ===

Why use UPIntrFreeCell to manage global resources instead of UPSafeCell?

After comparing the code in rCore and the code in rCore-Tutorial-Code-2022S, I notice that rCore uses UPIntrFreeCell to manage the global resources while the lab code uses UPSafeCell.
Why the change is necessary? In fact the document didn't give any explanation. And most confusing is that when we access the value in UPIntrFreeCell, the sie is read and some information is recorded in IntrMaskingInfo.
Can anyone help me ?

Weird code generation on RISC-V 64

The following code in memory.rs emits strange assembly code causing an infinite loop:

// T is specialized to some struct sized 336..
#[naked]
#[inline(never)]
#[link_section = ".text.copy_user"]
unsafe extern "C" fn write_user<T>(dst: *mut T, src: *const T) -> usize {
    dst.copy_from_nonoverlapping(src, 1);
    0
}

Generated assembly:

ffffffffc02000d6 <_ZN5rcore6memory12copy_to_user10write_user17h75f60bbde319fcafE>:
ffffffffc02000d6:	15000613          	li	a2,336 // struct size. 3rd argument of memcpy.
ffffffffc02000da:	00086097          	auipc	ra,0x86 // WHY IS IT USING ra FOR INTERMEDIATE ADDRESS CALCULATION?
ffffffffc02000de:	0f0080e7          	jalr	240(ra) # ffffffffc02861ca <memcpy> // now ra = ffffffffc02000e2 <li a0, 0>
ffffffffc02000e2:	4501                	li	a0,0 // BANG!
ffffffffc02000e4:	8082                	ret // goto BANG!

It seems that rustc optimizing copy_from_nonoverlapping into memcpy (in the naked function) results in this issue, but I'm not sure.

[Bug Report] wrong of fn write in the TcpSocketState

I think there are something wrong within the fn write in the TcpSocketState, Code below:

fn write(&self, data: &[u8], _sendto_endpoint: Option<Endpoint>) -> SysResult {
        // get the lock and handle of the global SOCKETS
        let mut sockets = SOCKETS.lock();
        let mut socket = sockets.get::<TcpSocket>(self.handle.0);

        if socket.is_open() {
            if socket.can_send() {
                match socket.send_slice(&data) {
                    Ok(size) => {
                        // avoid deadlock
                        drop(socket);
                        drop(sockets);

                        poll_ifaces();
                        Ok(size)
                    }
                    Err(_) => Err(SysError::ENOBUFS),
                }
            } else {
                Err(SysError::ENOBUFS)
            }
        } else {
            Err(SysError::ENOTCONN)
        }
    }

Withourt using the second parameter _sendto_endpoint
I'm considering that there maybe some problems , the parameter is not necessary , tcp first bind and connect with a endpoint which ensure the data transfer to the endpoint

coredump in Ubuntu20.04/x86-64

how to reproduce?

step 1,
rustup component add rust-src llvm-tools-preview

step 2,
run the command in https://github.com/rcore-os/rCore#how-to-run:

$ git clone https://github.com/rcore-os/rCore.git --recursive
It workks well

$ cd rCore/user
$ make sfsimg prebuilt=1 arch=x86_64
It workks well too

$ cd ../kernel
$ make run ARCH=x86_64 LOG=trace
// ...
warning: unused import: lazy_static::*
--> src/memory.rs:24:5
|
24 | use lazy_static::*;
| ^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default

warning: unnecessary parentheses around if condition
--> src/sync/mutex.rs:150:12
|
150 | if (initialization == 2) {
| ^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
|
= note: #[warn(unused_parens)] on by default

warning: unnecessary parentheses around if condition
--> src/sync/mutex.rs:153:12
|
153 | if (initialization == 1
| ^
154 | | || self
155 | | .support_initialization
156 | | .compare_and_swap(0, 1, Ordering::Acquire)
157 | | != 0)
| |
_________^
|
help: remove these parentheses
|
153 | if initialization == 1
154 | || self
155 | .support_initialization
156 | .compare_and_swap(0, 1, Ordering::Acquire)
157 | != 0
|

warning: use of deprecated item 'sync::condvar::Condvar::_wait': this may leads to lost wakeup problem. please use wait instead.
--> src/sync/mutex.rs:318:14
|
318 | self._wait();
| ^^^^^
|
= note: #[warn(deprecated)] on by default

// ...

error: "/root/.rustup/toolchains/nightly-2020-04-06-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/Cargo.lock" does not exist, unable to build with the standard library, try:
rustup component add rust-src
make: *** [Makefile:301: kernel] Error 101
// ...
make[1]: 离开目录“/root/桌面/rCore/rboot”
qemu-system-x86_64: -device ide-drive,drive=sfsimg,bus=ahci0.0: warning: 'ide-drive' is deprecated, please use 'ide-hd' or 'ide-cd' instead

I run the command in step 1 again,
then I change ide-drive to ide-hd:

-device ide-drive,drive=sfsimg,bus=ahci0.0

and remove the start @ in justrun:
@$(qemu) $(qemu_opts)

and then run make run ARCH=x86_64 LOG=trace again, it shows:
qemu-system-x86_64 -smp cores=4 -bios ../rboot/OVMF.fd -drive format=raw,file=fat:rw:target/x86_64/release/esp -serial mon:stdio -m 4G -device isa-debug-exit -drive format=qcow2,file=../user/build/x86_64.qcow2,media=disk,cache=writeback,id=sfsimg,if=none -device ahci,id=ahci0 -device ide-hd,drive=sfsimg,bus=ahci0.0 -nographic

as above, it just block here, and show nothing.
then I type ctrl + a, and then type c, then it shows:
QEMU 4.2.0 monitor - type 'help' for more information
(qemu) quit # type quit and enter
make: *** [Makefile:248: justrun] 段错误 (core dumped)

but Qemu works well with my own images, and all the related toolchains are latest.
Could you give some help ?

duplicate timespec struct

There are two timespec structs:

  • TimeSpec in rCore/syscall/time.rs
  • Timespec in rcore-fs/rcore-fs/src/vfs.rs

This can be inconvenient and confusing. Maybe remove one of them?

Should init process id be 1 instead of 0?

ref here.

The first process created in a new namespace (i.e., the process
created using clone(2) with the CLONE_NEWPID flag, or the first child
created by a process after a call to unshare(2) using the
CLONE_NEWPID flag) has the PID 1, and is the "init" process for the
namespace (see init(1)).

On the other hand, zero pid has preserved in some system calls, this can be ambiguous.

rust-toolchain should update

run
make sfsimg PREBUILT=1 ARCH=riscv32
Caused by:
this version of Cargo is older than the 2021 edition, and only supports 2015 and 2018 editions.
Makefile:301: recipe for target 'rcore-fs-fuse' failed

Successfully run after updating the content of rust-toolchain to nightly-2022-06-27.

question in "how to run"

When I run the command "make run arch={riscv32,riscv64,x86_64,aarch64,mipsel}", I received a message said that "make: *** No rule to make target 'src/arch/mipsel/board/none/device.dtb', needed by 'kernel'. Stop.". And then I try to run in each one, everyone return me an error.
So how should I do to result it?

Fix the Net Function

We want to fix the Net Function but first we want to roll back to the old version to let the net function successfully run

  • I check out the net branch, but there are many version problems come up , I ask an issue on the crate repository but it cames out more conflict of versions

So I want to ask if there are some ways to roll back to the old version to let the net function successfully run ?

Is pagefault on RISC-V supported?

I searched through the source code (crate/riscv and kernel/src/arch),
but could not find any code piece related to pagefault handing on rv.

Issue with networking

Hello, when I try to enable a e1000 PCI device I receive this error:

make run ARCH=x86_64 NET=on LOG=info
Building x86_64 kernel
warning: use of deprecated item 'sync::condvar::Condvar::_wait': this may leads to lost wakeup problem. please use `wait` instead.
   --> src/sync/mutex.rs:290:14
    |
290 |         self._wait();
    |              ^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

    Finished release [optimized] target(s) in 0.06s
make[1]: Entering directory '/home/josh/Projects/rCore/rboot'
cargo build -Z build-std=core,alloc --target x86_64-unknown-uefi --release
    Finished release [optimized] target(s) in 0.03s
make[1]: Leaving directory '/home/josh/Projects/rCore/rboot'
vvfat target/x86_64/release/esp chs 1024,16,63
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
qemu-system-x86_64: -device e1000e,netdev=net0: failed to find romfile "efi-e1000e.rom"
Makefile:248: recipe for target 'justrun' failed
make: *** [justrun] Error 1

Thank you in advance! This project is very cool!

cannot build

It is same as chyyuu/os_kernel_lab#92
when i exec make sfsimg PREBUILT=1 ARCH=x86_64 .
It seems due to the rustc version. So I switched to nightly-2021-9-13,it worked on above step but failed in make run ... then I switched to nightly-2020-6-4 but still failed.

Is this project still under maintenance

These days I tried to build the rCore(x86_64) but failed. Some libs like bitvec could not be built. Also rcore-fs-hostfs changed the edition which causes Cargo cannot build the sfs.

I tried my best to resolve these issues but found that the lib dependencies caused a ton of matters. So, can you give me some suggestions for compiling it?

Thx.

Kernel panic in debug mode

Environment

  • macOS Catalina 10.15.3
  • rCore maser cd81f4c
  • rustc 1.42.0-nightly (488406183 2020-01-16)
  • cargo 1.42.0-nightly (ad3dbe10e 2020-01-13)
  • QEMU 4.2.0

x86_64

$ make ARCH=x86_64 MODE=debug run
BdsDxe: loading Boot0001 "UEFI QEMU HARDDISK QM00001 " from PciRoot(0x0)/Pci(0x1,0x1)/Ata(Primary,Master,0x0)
BdsDxe: starting Boot0001 "UEFI QEMU HARDDISK QM00001 " from PciRoot(0x0)/Pci(0x1,0x1)/Ata(Primary,Master,0x0)
INFO: bootloader is running
INFO: opening file: \EFI\Boot\rboot.conf
INFO: loading file to memory
INFO: switching graphic mode
INFO: config: Config {
INFO:     physical_memory_offset: 0xffff800000000000,
INFO:     kernel_path: "\\EFI\\rCore\\kernel.elf",
INFO:     resolution: Some(
INFO:         (
INFO:             0x400,
INFO:             0x300,
INFO:         ),
INFO:     ),
INFO: }
INFO: acpi2: 0xbfbfa014
INFO: opening file: \EFI\rCore\kernel.elf
INFO: loading file to memory
INFO: mapping ELF
INFO: mapping physical memory
INFO: starting application processors
INFOHello world! from CPU 2!
:Hello  world! from CPeU 3!
xiHello world! from CPU 1!
t boot services
Hello world! from CPU 0!
=== BEGIN rCore stack trace ===
#00 PC: 0xFFFFFF00003DA86B FP: 0xFFFF8000BFEDC158
=== END rCore stack trace ===

addr2line info

$ make ARCH=x86_64 MODE=debug addr2line
#00 PC: 0xFFFFFF00003DA86B FP: 0xFFFF8000BFEDC158 rust_begin_unwind
/Users/equation/Desktop/rCore/kernel/src/lang.rs:13

ARM

$ make ARCH=aarch64 MODE=debug run
Hello Raspberry Pi 3! from CPU 0
Hello Raspberry Pi 3! from CPU 1
Hello Raspberry Pi 3! from CPU 3
Hello Raspberry Pi 3! from CPU 2

    ____                __   ____  _____
   / __ \ __  __ _____ / /_ / __ \/ ___/
  / /_/ // / / // ___// __// / / /\__ \
 / _, _// /_/ /(__  )/ /_ / /_/ /___/ /
/_/ |_| \__,_//____/ \__/ \____//____/

=== BEGIN rCore stack trace ===
#00 PC: 0xFFFF00000010EE5C FP: 0xFFFF000001DF9A50
#01 PC: 0xFFFF00000010FA54 FP: 0xFFFF000001DF9AB0
#02 PC: 0xFFFF00000010F9CC FP: 0xFFFF000001DF9AE0
#03 PC: 0xFFFF0000000F31E4 FP: 0xFFFF000001DF9B30
#04 PC: 0xFFFF0000000EE920 FP: 0xFFFF000001DF9B70
#05 PC: 0xFFFF000000083B94 FP: 0xFFFF000001DF9CC0
#06 PC: 0xFFFF00000008A4D0 FP: 0xFFFF000001DF9D80
#07 PC: 0xFFFF0000000808A0 FP: 0xFFFF000001DF9E30
#08 PC: 0xFFFF0000000C3C78 FP: 0xFFFF000001DF9F60
=== END rCore stack trace ===

addr2line info

$ make ARCH=aarch64 MODE=debug addr2line
#00 PC: 0xFFFF00000010EE5C FP: 0xFFFF000001DF9A50 rust_begin_unwind
/Users/equation/Desktop/rCore/kernel/src/lang.rs:13
#01 PC: 0xFFFF00000010FA54 FP: 0xFFFF000001DF9AB0 core::panic::PanicInfo::internal_constructor::h839123a285b64c4c
/Users/equation/.rustup/toolchains/nightly-2020-01-17-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/panic.rs:53
#02 PC: 0xFFFF00000010F9CC FP: 0xFFFF000001DF9AE0 core::fmt::Arguments::new_v1::hbcc6d8b0d627e8b0
/Users/equation/.rustup/toolchains/nightly-2020-01-17-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/fmt/mod.rs:314
#03 PC: 0xFFFF0000000F31E4 FP: 0xFFFF000001DF9B30 alloc::vec::Vec$LT$T$GT$::set_len::hab909e4b49cda365
/Users/equation/.cargo/git/checkouts/rcore-fs-7fdf258332f6146d/d8d6119/rcore-fs-sfs/<::core::macros::panic macros>:2
#04 PC: 0xFFFF0000000EE920 FP: 0xFFFF000001DF9B70 _$LT$bitvec..vec..BitVec$LT$C$C$T$GT$$u20$as$u20$core..convert..From$LT$$RF$$u5b$T$u5d$$GT$$GT$::from::h38fbdfa07cd35393
/Users/equation/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.9.0/src/vec.rs:717
#05 PC: 0xFFFF000000083B94 FP: 0xFFFF000001DF9CC0 alloc::sync::Arc$LT$T$GT$::new::haef63d63c50fddf9
/Users/equation/.rustup/toolchains/nightly-2020-01-17-x86_64-apple-darwin/lib/rustlib/src/rust/src/liballoc/sync.rs:302
#06 PC: 0xFFFF00000008A4D0 FP: 0xFFFF000001DF9D80 alloc::vec::Vec$LT$T$GT$::from_raw_parts::hfd94265f3fedb333
/Users/equation/.rustup/toolchains/nightly-2020-01-17-x86_64-apple-darwin/lib/rustlib/src/rust/src/liballoc/vec.rs:456
#07 PC: 0xFFFF0000000808A0 FP: 0xFFFF000001DF9E30 core::iter::range::_$LT$impl$u20$core..iter..traits..iterator..Iterator$u20$for$u20$core..ops..range..Range$LT$A$GT$$GT$::next::hc61b376b24775205
/Users/equation/.rustup/toolchains/nightly-2020-01-17-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/iter/range.rs:212
#08 PC: 0xFFFF0000000C3C78 FP: 0xFFFF000001DF9F60 master_main
/Users/equation/Desktop/rCore/kernel/src/arch/aarch64/mod.rs:38

RISCV

$ make ARCH=riscv64 MODE=debug run
OpenSBI v0.5 (Oct  9 2019 12:03:04)
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name          : QEMU Virt Machine
Platform HART Features : RV64ACDFIMSU
Platform Max HARTs     : 8
Current Hart           : 0
Firmware Base          : 0x80000000
Firmware Size          : 116 KB
Runtime SBI Version    : 0.2

PMP0: 0x0000000080000000-0x000000008001ffff (A)
PMP1: 0x0000000000000000-0xffffffffffffffff (A,R,W,X)
Hello RISCV! in hart 0, device tree @ 0xffffffffc2200000
Device features NOTIFY_ON_EMPTY | ANY_LAYOUT | RING_INDIRECT_DESC | RING_EVENT_IDX
=== BEGIN rCore stack trace ===
#00 PC: 0xFFFFFFFFC02B1E6E FP: 0xFFFFFFFFC02F3A00
#01 PC: 0xFFFFFFFFC02B2932 FP: 0xFFFFFFFFC02F3A60
#02 PC: 0xFFFFFFFFC02B288C FP: 0xFFFFFFFFC02F3A90
#03 PC: 0xFFFFFFFFC027FE04 FP: 0xFFFFFFFFC02F3AE0
#04 PC: 0xFFFFFFFFC027B420 FP: 0xFFFFFFFFC02F3B20
#05 PC: 0xFFFFFFFFC0221032 FP: 0xFFFFFFFFC02F3C60
#06 PC: 0xFFFFFFFFC026C80A FP: 0xFFFFFFFFC02F3D80
#07 PC: 0xFFFFFFFFC02004CC FP: 0xFFFFFFFFC02F3E30
#08 PC: 0xFFFFFFFFC02038B0 FP: 0xFFFFFFFFC02F3F80
=== END rCore stack trace ===

addr2line info

$ make ARCH=riscv64 MODE=debug addr2line
#00 PC: 0xFFFFFFFFC02B1E6E FP: 0xFFFFFFFFC02F3A00 rcore::backtrace::backtrace
/Users/equation/Desktop/rCore/kernel/src/backtrace.rs:74
#01 PC: 0xFFFFFFFFC02B2932 FP: 0xFFFFFFFFC02F3A60 core::panicking::panic_fmt
/Users/equation/.rustup/toolchains/nightly-2020-01-17-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/panicking.rs:85
#02 PC: 0xFFFFFFFFC02B288C FP: 0xFFFFFFFFC02F3A90 core::panicking::panic
/Users/equation/.rustup/toolchains/nightly-2020-01-17-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/panicking.rs:52
#03 PC: 0xFFFFFFFFC027FE04 FP: 0xFFFFFFFFC02F3AE0 alloc::vec::Vec<T>::set_len
/Users/equation/.cargo/git/checkouts/rcore-fs-7fdf258332f6146d/d8d6119/rcore-fs-sfs/<::core::macros::panic macros>:2
#04 PC: 0xFFFFFFFFC027B420 FP: 0xFFFFFFFFC02F3B20 <bitvec::vec::BitVec<C,T> as core::convert::From<&[T]>>::from
/Users/equation/.cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.9.0/src/vec.rs:717
#05 PC: 0xFFFFFFFFC0221032 FP: 0xFFFFFFFFC02F3C60 <rcore::fs::ROOT_INODE as core::ops::deref::Deref>::deref::__static_ref_initialize
/Users/equation/Desktop/rCore/kernel/src/fs/mod.rs:79
#06 PC: 0xFFFFFFFFC026C80A FP: 0xFFFFFFFFC02F3D80 lazy_static::lazy::Lazy<T>::get
/Users/equation/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/core_lazy.rs:21
#07 PC: 0xFFFFFFFFC02004CC FP: 0xFFFFFFFFC02F3E30 rcore::process::init
/Users/equation/Desktop/rCore/kernel/src/process/mod.rs:22
#08 PC: 0xFFFFFFFFC02038B0 FP: 0xFFFFFFFFC02F3F80 rust_main
/Users/equation/Desktop/rCore/kernel/src/arch/riscv/mod.rs:71

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.