forked from M-Labs/artiq
1
0
Fork 0

runtime: bump libfringe, impl ecall abi

See libfringe PR: M-Labs/libfringe#1
This commit is contained in:
occheung 2021-10-08 14:38:30 +08:00 committed by Sébastien Bourdeauducq
parent 0a59c889de
commit 46326716fd
4 changed files with 17 additions and 4 deletions

View File

@ -163,9 +163,9 @@ dependencies = [
[[package]]
name = "fringe"
version = "1.2.1"
source = "git+https://git.m-labs.hk/M-Labs/libfringe.git?rev=9748bb#9748bb8af86c131d45be1238ea4d5f965a974630"
source = "git+https://git.m-labs.hk/M-Labs/libfringe.git?rev=3ecbe5#3ecbe53f7644b18ee46ebd5b2ca12c9cbceec43a"
dependencies = [
"libc 0.2.101",
"libc 0.2.103",
]
[[package]]

View File

@ -32,6 +32,6 @@ riscv = { version = "0.6.0", features = ["inline-asm"] }
[dependencies.fringe]
git = "https://git.m-labs.hk/M-Labs/libfringe.git"
rev = "9748bb"
rev = "3ecbe5"
default-features = false
features = ["alloc"]

View File

@ -290,6 +290,18 @@ pub extern fn exception(regs: *const TrapFrame) {
mcause::Trap::Interrupt(source) => {
info!("Called interrupt with {:?}", source);
},
mcause::Trap::Exception(mcause::Exception::UserEnvCall) => {
unsafe {
if (*regs).a7 == 0 {
pmp::pop_pmp_region()
} else {
pmp::push_pmp_region((*regs).a7)
}
}
mepc::write(pc + 4);
},
mcause::Trap::Exception(e) => {
println!("Trap frame: {:x?}", unsafe { *regs });

View File

@ -61,7 +61,8 @@ impl Thread {
let spawned = io.spawned.clone();
let sockets = io.sockets.clone();
let stack = OwnedStack::new(stack_size);
// Add a 4k stack guard to the stack of any new threads
let stack = OwnedStack::new(stack_size + 4096);
ThreadHandle::new(Thread {
generator: Generator::unsafe_new(stack, |yielder, _| {
f(Io {