Skip to content

Commit

Permalink
chore: dummy implement syscall mount/umount
Browse files Browse the repository at this point in the history
  • Loading branch information
Yttehs-HDX committed Dec 8, 2024
1 parent 1783f92 commit a0d2f4d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ fn run_test() -> ! {
"getcwd",
// "munmap",
"pipe",
// "umount",
"umount",
"close",
"getppid",
"chdir",
"open",
// "clone",
// "mount",
"mount",
"exit",
"sleep",
// "mmap",
Expand Down
10 changes: 10 additions & 0 deletions kernel/src/syscall/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,13 @@ pub fn sys_pipe(pipe_ptr: *mut i32) -> isize {
}
0
}

pub fn sys_mount(_source_ptr: *const u8, _target_ptr: *const u8, _fs_type_ptr: *const u8) -> isize {
// unsupported for rust-fatfs
0
}

pub fn sys_umount(_target_ptr: *const u8) -> isize {
// unsupported for rust-fatfs
0
}
4 changes: 4 additions & 0 deletions kernel/src/syscall/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const SYSCALL_CLOSE: usize = 57;
const SYSCALL_MKDIR: usize = 34;
const SYSCALL_PIPE: usize = 59;
const SYSCALL_NANO_SLEEP: usize = 101;
const SYSCALL_MOUNT: usize = 40;
const SYSCALL_UMOUNT: usize = 39;

pub fn syscall(id: usize, args: [usize; 6]) -> isize {
match id {
Expand All @@ -45,6 +47,8 @@ pub fn syscall(id: usize, args: [usize; 6]) -> isize {
SYSCALL_MKDIR => sys_mkdir(args[0], args[1] as *const u8, args[2]),
SYSCALL_PIPE => sys_pipe(args[0] as *mut i32),
SYSCALL_NANO_SLEEP => sys_nanosleep(args[0] as *const u8, args[1]),
SYSCALL_MOUNT => sys_mount(args[0] as *const u8, args[1] as *const u8, args[2] as *const u8),
SYSCALL_UMOUNT => sys_umount(args[0] as *const u8),
_ => {
error!("Unsupported syscall id: {}", id);
sys_exit(-1);
Expand Down

0 comments on commit a0d2f4d

Please sign in to comment.