提交 f5c029d3 编写于 作者: Y Yifan Wu

k210 only can use 6M before configuring sdcard.

上级 84b10893
pub const USER_STACK_SIZE: usize = 4096 * 2; pub const USER_STACK_SIZE: usize = 4096 * 2;
pub const KERNEL_STACK_SIZE: usize = 4096 * 2; pub const KERNEL_STACK_SIZE: usize = 4096 * 2;
pub const KERNEL_HEAP_SIZE: usize = 0x30_0000; pub const KERNEL_HEAP_SIZE: usize = 0x20_0000;
pub const MEMORY_END: usize = 0x80800000; pub const MEMORY_END: usize = 0x80600000;
pub const PAGE_SIZE: usize = 0x1000; pub const PAGE_SIZE: usize = 0x1000;
pub const PAGE_SIZE_BITS: usize = 0xc; pub const PAGE_SIZE_BITS: usize = 0xc;
......
...@@ -6,7 +6,7 @@ extern crate user_lib; ...@@ -6,7 +6,7 @@ extern crate user_lib;
use user_lib::{fork, wait, exit}; use user_lib::{fork, wait, exit};
const MAX_CHILD: usize = 20; const MAX_CHILD: usize = 40;
#[no_mangle] #[no_mangle]
pub fn main() -> i32 { pub fn main() -> i32 {
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
#[macro_use] #[macro_use]
extern crate user_lib; extern crate user_lib;
use user_lib::{fork, wait, get_time, getpid, exit, yield_,}; use user_lib::{fork, wait, getpid, exit, sleep, get_time};
static NUM: usize = 13; static NUM: usize = 30;
#[no_mangle] #[no_mangle]
pub fn main() -> i32 { pub fn main() -> i32 {
...@@ -15,11 +15,9 @@ pub fn main() -> i32 { ...@@ -15,11 +15,9 @@ pub fn main() -> i32 {
if pid == 0 { if pid == 0 {
let current_time = get_time(); let current_time = get_time();
let sleep_length = (current_time as i32 as isize) * (current_time as i32 as isize) % 1000 + 1000; let sleep_length = (current_time as i32 as isize) * (current_time as i32 as isize) % 1000 + 1000;
println!("Subprocess {} sleep for {} ms", getpid(), sleep_length); println!("pid {} sleep for {} ms", getpid(), sleep_length);
while get_time() < current_time + sleep_length { sleep(sleep_length as usize);
yield_(); println!("pid {} OK!", getpid());
}
println!("Subprocess {} OK!", getpid());
exit(0); exit(0);
} }
} }
......
...@@ -6,7 +6,7 @@ extern crate user_lib; ...@@ -6,7 +6,7 @@ extern crate user_lib;
use user_lib::{sleep, getpid, fork, exit, yield_}; use user_lib::{sleep, getpid, fork, exit, yield_};
const DEPTH: usize = 3; const DEPTH: usize = 4;
fn fork_child(cur: &str, branch: char) { fn fork_child(cur: &str, branch: char) {
let mut next = [0u8; DEPTH + 1]; let mut next = [0u8; DEPTH + 1];
......
...@@ -6,7 +6,7 @@ extern crate user_lib; ...@@ -6,7 +6,7 @@ extern crate user_lib;
use user_lib::{fork, wait, yield_, exit, getpid, get_time}; use user_lib::{fork, wait, yield_, exit, getpid, get_time};
static NUM: usize = 20; static NUM: usize = 35;
const N: usize = 10; const N: usize = 10;
static P: i32 = 10007; static P: i32 = 10007;
type Arr = [[i32; N]; N]; type Arr = [[i32; N]; N];
......
...@@ -32,7 +32,7 @@ pub fn main() -> i32 { ...@@ -32,7 +32,7 @@ pub fn main() -> i32 {
// child process // child process
if exec(line.as_str()) == -1 { if exec(line.as_str()) == -1 {
println!("Error when executing!"); println!("Error when executing!");
return 0; return -4;
} }
unreachable!(); unreachable!();
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册