Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Godones committed Jul 28, 2023
1 parent bb43b3d commit 076692d
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 140 deletions.
Binary file modified kernel-qemu
Binary file not shown.
268 changes: 134 additions & 134 deletions kernel/src/syscall.rs
Original file line number Diff line number Diff line change
@@ -1,141 +1,141 @@
use spin::Once;
use syscall_table::{register_syscall, Table};
static SYSCALL_TABLE: Once<Table> = Once::new();
pub fn register_all_syscall() {
let mut table = Table::new();
register_syscall!(
table,
(160, uname),
(198, socket),
(200, bind),
(201, listening),
(202, accept),
(203, connect),
(204, getsockname),
(206, sendto),
(207, recvfrom),
(208, setsockopt),
(209, getsockopt),
(210, shutdown),
(199, socket_pair),
(2003, system_shutdown),
(169, get_time_of_day),
(153, times),
(101, nanosleep),
(113, clock_get_time),
(102, getitimer),
(103, setitimer),
(114, clock_getres),
(115, clock_nanosleep),
(116, syslog),
(179, sys_info),
(118, sched_setparam),
(121, sched_getparam),
(122, sched_setaffinity),
(123, sched_getaffinity),
(120, sched_getscheduler),
(119, sched_setscheduler),
(165, getrusage),
(2002, sys_event_get),
(2000, sys_framebuffer),
(2001, sys_framebuffer_flush),
(59, sys_pipe),
(23, sys_dup),
(24, sys_dup2),
(98, futex),
(99, set_robust_list),
(100, get_robust_list),
(134, sigaction),
(137, sigtimewait),
(135, sigprocmask),
(129, kill),
(130, tkill),
(139, signal_return),
(133, sigsuspend),
(194, shmget),
(196, shmat),
(195, shmctl),
(93, do_exit),
(94, exit_group),
(124, do_suspend),
(154, set_pgid),
(155, git_pgid),
(172, get_pid),
(173, get_ppid),
(174, getuid),
(175, geteuid),
(176, getgid),
(177, getegid),
(178, get_tid),
(220, clone),
(221, do_exec),
(260, wait4),
(214, do_brk),
(96, set_tid_address),
(261, prlimit64),
(40, sys_mount),
(39, sys_umount),
(56, sys_openat),
(57, sys_close),
(61, sys_getdents),
(45, sys_truncate),
(46, sys_ftruncate),
(63, sys_read),
(64, sys_write),
(17, sys_getcwd),
(49, sys_chdir),
(83, sys_mkdir),
(62, sys_lseek),
(80, sys_fstat),
(37, sys_linkat),
(35, sys_unlinkat),
(36, sys_symlinkat),
(78, sys_readlinkat),
(79, sys_fstateat),
(44, sys_fstatfs),
(43, sys_statfs),
(276, sys_renameat),
(34, sys_mkdirat),
(5, sys_setxattr),
(6, sys_lsetxattr),
(7, sys_fsetxattr),
(8, sys_getxattr),
(9, sys_lgetxattr),
(10, sys_fgetxattr),
(11, sys_listxattr),
(12, sys_llistxattr),
(13, sys_flistxattr),
(14, sys_removexattr),
(15, sys_lremovexattr),
(66, sys_writev),
(65, sys_readv),
(67, sys_pread),
(68, sys_pwrite),
(16, sys_fremovexattr),
(71, send_file),
(81, sync),
(82, fsync),
(25, fcntl),
(29, ioctl),
(88, utimensat),
(48, faccessat),
(52, chmod),
(53, chmodat),
(166, unmask),
(72, pselect6),
(73, ppoll),
(283, membarrier),
(215, do_munmap),
(222, do_mmap),
(226, map_protect),
(227, msync),
(233, madvise),
);
SYSCALL_TABLE.call_once(|| table);
pub fn register_all_syscall(){
let mut table = Table::new();
register_syscall!(table,
(160, uname),
(198, socket),
(200, bind),
(201, listening),
(202, accept),
(203, connect),
(204, getsockname),
(206, sendto),
(207, recvfrom),
(208, setsockopt),
(209, getsockopt),
(210, shutdown),
(199, socket_pair),
(2003, system_shutdown),
(169, get_time_of_day),
(153, times),
(101, nanosleep),
(113, clock_get_time),
(102, getitimer),
(103, setitimer),
(114, clock_getres),
(115, clock_nanosleep),
(116, syslog),
(179, sys_info),
(118, sched_setparam),
(121, sched_getparam),
(122, sched_setaffinity),
(123, sched_getaffinity),
(120, sched_getscheduler),
(119, sched_setscheduler),
(165, getrusage),
(2002, sys_event_get),
(2000, sys_framebuffer),
(2001, sys_framebuffer_flush),
(59, sys_pipe),
(23, sys_dup),
(24, sys_dup2),
(98, futex),
(99, set_robust_list),
(100, get_robust_list),
(134, sigaction),
(137, sigtimewait),
(135, sigprocmask),
(129, kill),
(130, tkill),
(139, signal_return),
(133, sigsuspend),
(194, shmget),
(196, shmat),
(195, shmctl),
(93, do_exit),
(94, exit_group),
(124, do_suspend),
(154, set_pgid),
(155, git_pgid),
(172, get_pid),
(173, get_ppid),
(174, getuid),
(175, geteuid),
(176, getgid),
(177, getegid),
(178, get_tid),
(220, clone),
(221, do_exec),
(260, wait4),
(214, do_brk),
(96, set_tid_address),
(261, prlimit64),
(40, sys_mount),
(39, sys_umount),
(56, sys_openat),
(57, sys_close),
(61, sys_getdents),
(45, sys_truncate),
(46, sys_ftruncate),
(63, sys_read),
(64, sys_write),
(17, sys_getcwd),
(49, sys_chdir),
(83, sys_mkdir),
(62, sys_lseek),
(80, sys_fstat),
(37, sys_linkat),
(35, sys_unlinkat),
(36, sys_symlinkat),
(78, sys_readlinkat),
(79, sys_fstateat),
(44, sys_fstatfs),
(43, sys_statfs),
(276, sys_renameat),
(34, sys_mkdirat),
(5, sys_setxattr),
(6, sys_lsetxattr),
(7, sys_fsetxattr),
(8, sys_getxattr),
(9, sys_lgetxattr),
(10, sys_fgetxattr),
(11, sys_listxattr),
(12, sys_llistxattr),
(13, sys_flistxattr),
(14, sys_removexattr),
(15, sys_lremovexattr),
(66, sys_writev),
(65, sys_readv),
(67, sys_pread),
(68, sys_pwrite),
(16, sys_fremovexattr),
(71, send_file),
(81, sync),
(82, fsync),
(25, fcntl),
(29, ioctl),
(88, utimensat),
(48, faccessat),
(52, chmod),
(53, chmodat),
(166, unmask),
(72, pselect6),
(73, ppoll),
(283, membarrier),
(215, do_munmap),
(222, do_mmap),
(226, map_protect),
(227, msync),
(233, madvise),

);
SYSCALL_TABLE.call_once(||table);
}
pub fn do_syscall(id: usize, args: &[usize]) -> Option<isize> {
let res = SYSCALL_TABLE.get().unwrap().do_call(id, &args);
res
pub fn do_syscall(id:usize,args:&[usize])->Option<isize>{
let res = SYSCALL_TABLE.get().unwrap().do_call(id,&args);
res
}
use crate::driver::sys_event_get;
use crate::fs::chmod;
Expand Down
12 changes: 6 additions & 6 deletions kernel/src/task/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ use lazy_static::lazy_static;
use spin::Once;

use kernel_sync::Mutex;
use syscall_define::{PrLimit, PrLimitRes};
use syscall_define::ipc::FutexOp;
use syscall_define::signal::SignalNumber;
use syscall_define::task::{CloneFlags, WaitOptions};
use syscall_define::{PrLimit, PrLimitRes};
use syscall_table::syscall_func;

use crate::arch;
use crate::config::CPU_NUM;
use crate::fs::vfs;
use crate::ipc::{futex, global_logoff_signals};
use crate::sbi::system_shutdown;
use crate::task::{INIT_PROCESS, LIBC_BENCH2};
use crate::task::context::Context;
use crate::task::schedule::schedule;
use crate::task::task::{Task, TaskState};
use crate::task::{INIT_PROCESS, LIBC_BENCH2};
use crate::trap::{check_task_timer_expired, TrapFrame};

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -245,10 +245,10 @@ pub fn clone(flag: usize, stack: usize, ptid: usize, tls: usize, ctid: usize) ->
let sig = SignalNumber::from(sig);
let task = current_task().unwrap();

// let child_num = task.access_inner().children.len();
// if child_num >= 10 {
// do_suspend();
// }
let child_num = task.access_inner().children.len();
if child_num >= 10 {
do_suspend();
}
let new_task = task.t_clone(clone_flag, stack, sig, ptid, tls, ctid);
if new_task.is_none() {
return -1;
Expand Down

0 comments on commit 076692d

Please sign in to comment.