Skip to content

Commit 03c7e4d

Browse files
committed
new ch3-2025s
1 parent 6120899 commit 03c7e4d

File tree

4 files changed

+11
-23
lines changed

4 files changed

+11
-23
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ easy-fs-fuse/target/*
1515
tools/
1616
pushall.sh
1717
*.bak
18-
19-
user/*
18+
ci-user/
19+
user/
20+
os/vendor/

os/src/config.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ pub const APP_BASE_ADDRESS: usize = 0x80400000;
1515
/// size limit of app
1616
pub const APP_SIZE_LIMIT: usize = 0x20000;
1717

18-
/// the max number of syscall
19-
pub const MAX_SYSCALL_NUM: usize = 500;
2018
/// clock frequency
2119
pub const CLOCK_FREQ: usize = 12500000;
2220
/// the physical memory end

os/src/syscall/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,23 @@ const SYSCALL_EXIT: usize = 93;
1818
const SYSCALL_YIELD: usize = 124;
1919
/// gettime syscall
2020
const SYSCALL_GET_TIME: usize = 169;
21-
/// taskinfo syscall
22-
const SYSCALL_TASK_INFO: usize = 410;
21+
/// trace syscall
22+
const SYSCALL_TRACE: usize = 410;
2323

2424
mod fs;
2525
mod process;
2626

2727
use fs::*;
2828
use process::*;
29+
2930
/// handle syscall exception with `syscall_id` and other arguments
3031
pub fn syscall(syscall_id: usize, args: [usize; 3]) -> isize {
3132
match syscall_id {
3233
SYSCALL_WRITE => sys_write(args[0], args[1] as *const u8, args[2]),
3334
SYSCALL_EXIT => sys_exit(args[0] as i32),
3435
SYSCALL_YIELD => sys_yield(),
3536
SYSCALL_GET_TIME => sys_get_time(args[0] as *mut TimeVal, args[1]),
36-
SYSCALL_TASK_INFO => sys_task_info(args[0] as *mut TaskInfo),
37+
SYSCALL_TRACE => sys_trace(args[0], args[1], args[2]),
3738
_ => panic!("Unsupported syscall_id: {}", syscall_id),
3839
}
3940
}

os/src/syscall/process.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Process management syscalls
22
use crate::{
3-
config::MAX_SYSCALL_NUM,
4-
task::{exit_current_and_run_next, suspend_current_and_run_next, TaskStatus},
3+
task::{exit_current_and_run_next, suspend_current_and_run_next},
54
timer::get_time_us,
65
};
76

@@ -12,17 +11,6 @@ pub struct TimeVal {
1211
pub usec: usize,
1312
}
1413

15-
/// Task information
16-
#[allow(dead_code)]
17-
pub struct TaskInfo {
18-
/// Task status in it's life cycle
19-
status: TaskStatus,
20-
/// The numbers of syscall called by task
21-
syscall_times: [u32; MAX_SYSCALL_NUM],
22-
/// Total running time of task
23-
time: usize,
24-
}
25-
2614
/// task exits and submit an exit code
2715
pub fn sys_exit(exit_code: i32) -> ! {
2816
trace!("[kernel] Application exited with code {}", exit_code);
@@ -50,8 +38,8 @@ pub fn sys_get_time(ts: *mut TimeVal, _tz: usize) -> isize {
5038
0
5139
}
5240

53-
/// YOUR JOB: Finish sys_task_info to pass testcases
54-
pub fn sys_task_info(_ti: *mut TaskInfo) -> isize {
55-
trace!("kernel: sys_task_info");
41+
// TODO: implement sys_trace
42+
pub fn sys_trace(_trace_request: usize, _id: usize, _data: usize) -> isize {
43+
trace!("kernel: sys_trace");
5644
-1
5745
}

0 commit comments

Comments
 (0)