diff --git a/kernel/Makefile b/kernel/Makefile index d21f3f5..cdd9e0d 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -33,8 +33,8 @@ arch ?= riscv64 board ?= none -mode ?= debug -LOG ?= debug +mode ?= release +LOG ?= graphic ?= off smp ?= 4 pci_passthru ?= diff --git a/kernel/events b/kernel/events deleted file mode 100644 index d99bc24..0000000 --- a/kernel/events +++ /dev/null @@ -1,62 +0,0 @@ -virtqueue_pop -virtio_blk_req_complete -virtio_blk_rw_complete -virtio_blk_submit_multireq -virtio_blk_handle_write -virtio_blk_handle_read -e1000e_link_status -e1000e_mac_set_sw -e1000e_irq_itr_set -e1000e_irq_eitr_set -e1000e_tx_disabled -e1000e_tx_descr -e1000e_rx_descr -#e1000e_rx_has_buffers -e1000e_rx_start_recv -#e1000e_rx_can_recv -e1000e_rx_can_recv_rings_full -e1000_receiver_overrun -#e1000e_rx_receive_iov -e1000e_core_ctrl_sw_reset -e1000e_core_ctrl_phy_reset -e1000e_rx_desc_buff_sizes -e1000e_rx_set_rctl -e1000e_rx_desc_len -e1000e_core_ctrl_write -e1000e_link_status_changed -e1000e_rx_rss_dispatched_to_queue -e1000e_rx_desc_buff_write -e1000e_rx_null_descriptor -e1000e_rx_set_rdt -e1000e_msix_use_vector_fail -e1000e_msix_init_fail -e1000e_msi_init_fail -e1000e_cb_pci_uninit -e1000e_cfg_support_virtio -e1000e_irq_msi_notify_postponed -e1000e_irq_msix_notify_postponed_vec -e1000e_irq_throttling_no_pending_vec -e1000e_irq_msix_notify_vec -e1000e_wrn_msix_vec_wrong -e1000e_wrn_msix_invalid -e1000e_irq_iam_clear_eiame -e1000e_irq_icr_clear_eiac -e1000e_irq_msi_notify -pci_update_mappings_del -pci_update_mappings_add -e1000e_irq_icr_write -e1000e_irq_icr_read_entry -e1000e_irq_legacy_notify -e1000e_irq_add_msi_other -e1000e_irq_pending_interrupts -e1000e_irq_icr_write -e1000e_irq_msix_notify_vec -e1000e_wrn_msix_vec_wrong -e1000e_wrn_msix_invalid -e1000e_irq_iam_clear_eiame -e1000e_irq_icr_clear_eiac -e1000e_irq_postponed_by_xitr -e1000e_intrmgr_rearm_timer -msix_* -#ahci_* -ide_* \ No newline at end of file diff --git a/kernel/src/logging.rs b/kernel/src/logging.rs index b832d50..838abe5 100644 --- a/kernel/src/logging.rs +++ b/kernel/src/logging.rs @@ -14,13 +14,12 @@ pub fn init() { static LOGGER: SimpleLogger = SimpleLogger; log::set_logger(&LOGGER).unwrap(); log::set_max_level(match option_env!("LOG") { - Some("off") => LevelFilter::Off, Some("error") => LevelFilter::Error, Some("warn") => LevelFilter::Warn, Some("info") => LevelFilter::Info, Some("debug") => LevelFilter::Debug, Some("trace") => LevelFilter::Trace, - _ => LevelFilter::Warn, + _ => LevelFilter::Off, }); } diff --git a/kernel/src/shell.rs b/kernel/src/shell.rs index fe8dc61..000ad63 100644 --- a/kernel/src/shell.rs +++ b/kernel/src/shell.rs @@ -8,12 +8,12 @@ use alloc::vec::Vec; #[cfg(not(feature = "run_cmdline"))] pub fn run_user_shell() { - if let Ok(inode) = ROOT_INODE.lookup("rust/sh") { + if let Ok(inode) = ROOT_INODE.lookup("busybox") { let data = inode.read_as_vec().unwrap(); processor().manager().add(Thread::new_user( data.as_slice(), - "rust/sh", - vec!["sh".into()], + "busybox", + vec!["busybox".into(), "sh".into()], Vec::new(), )); } else { diff --git a/kernel/src/syscall/fs.rs b/kernel/src/syscall/fs.rs index 4ad87e7..d9f843a 100644 --- a/kernel/src/syscall/fs.rs +++ b/kernel/src/syscall/fs.rs @@ -80,11 +80,14 @@ pub fn sys_ppoll(ufds: *mut PollFd, nfds: usize, timeout: *const TimeSpec) -> Sy } pub fn sys_poll(ufds: *mut PollFd, nfds: usize, timeout_msecs: usize) -> SysResult { - info!( - "poll: ufds: {:?}, nfds: {}, timeout_msecs: {:#x}", - ufds, nfds, timeout_msecs - ); let proc = process(); + if !proc.pid.is_init() { + // we trust pid 0 process + info!( + "poll: ufds: {:?}, nfds: {}, timeout_msecs: {:#x}", + ufds, nfds, timeout_msecs + ); + } proc.vm.check_write_array(ufds, nfds)?; let polls = unsafe { slice::from_raw_parts_mut(ufds, nfds) }; @@ -222,11 +225,14 @@ pub fn sys_readv(fd: usize, iov_ptr: *const IoVec, iov_count: usize) -> SysResul } pub fn sys_writev(fd: usize, iov_ptr: *const IoVec, iov_count: usize) -> SysResult { - info!( - "writev: fd: {}, iov: {:?}, count: {}", - fd, iov_ptr, iov_count - ); let mut proc = process(); + if !proc.pid.is_init() { + // we trust pid 0 process + info!( + "writev: fd: {}, iov: {:?}, count: {}", + fd, iov_ptr, iov_count + ); + } let iovs = IoVecs::check_and_new(iov_ptr, iov_count, &proc.vm, false)?; let buf = iovs.read_all_to_vec(); @@ -297,7 +303,7 @@ pub fn sys_faccessat(dirfd: usize, path: *const u8, mode: usize, flags: usize) - // we trust pid 0 process info!( "faccessat: dirfd: {}, path: {:?}, mode: {:#o}, flags: {:?}", - dirfd, path, mode, flags + dirfd as isize, path, mode, flags ); } let inode = proc.lookup_inode_at(dirfd, &path)?; @@ -342,7 +348,7 @@ pub fn sys_fstatat(dirfd: usize, path: *const u8, stat_ptr: *mut Stat, flags: us let flags = AtFlags::from_bits_truncate(flags); info!( "fstatat: dirfd: {}, path: {:?}, stat_ptr: {:?}, flags: {:?}", - dirfd, path, stat_ptr, flags + dirfd as isize, path, stat_ptr, flags ); let inode = proc.lookup_inode_at(dirfd, &path)?; @@ -525,7 +531,7 @@ pub fn sys_renameat( let newpath = unsafe { proc.vm.check_and_clone_cstr(newpath)? }; info!( "renameat: olddirfd: {}, oldpath: {:?}, newdirfd: {}, newpath: {:?}", - olddirfd, oldpath, newdirfd, newpath + olddirfd as isize, oldpath, newdirfd as isize, newpath ); let (old_dir_path, old_file_name) = split_path(&oldpath); @@ -546,7 +552,7 @@ pub fn sys_mkdirat(dirfd: usize, path: *const u8, mode: usize) -> SysResult { // TODO: check pathname info!( "mkdirat: dirfd: {}, path: {:?}, mode: {:#o}", - dirfd, path, mode + dirfd as isize, path, mode ); let (dir_path, file_name) = split_path(&path); @@ -590,7 +596,7 @@ pub fn sys_linkat( let flags = AtFlags::from_bits_truncate(flags); info!( "linkat: olddirfd: {}, oldpath: {:?}, newdirfd: {}, newpath: {:?}, flags: {:?}", - olddirfd, oldpath, newdirfd, newpath, flags + olddirfd as isize, oldpath, newdirfd as isize, newpath, flags ); let (new_dir_path, new_file_name) = split_path(&newpath); @@ -610,7 +616,7 @@ pub fn sys_unlinkat(dirfd: usize, path: *const u8, flags: usize) -> SysResult { let flags = AtFlags::from_bits_truncate(flags); info!( "unlinkat: dirfd: {}, path: {:?}, flags: {:?}", - dirfd, path, flags + dirfd as isize, path, flags ); let (dir_path, file_name) = split_path(&path); @@ -765,8 +771,8 @@ impl Process { ) -> Result, SysError> { let follow = true; debug!( - "lookup_inode_at: fd: {:?}, cwd: {:?}, path: {:?}, follow: {:?}", - dirfd, self.cwd, path, follow + "lookup_inode_at: dirfd: {:?}, cwd: {:?}, path: {:?}, follow: {:?}", + dirfd as isize, self.cwd, path, follow ); let follow_max_depth = if follow { FOLLOW_MAX_DEPTH } else { 0 }; if dirfd == AT_FDCWD { diff --git a/kernel/src/syscall/proc.rs b/kernel/src/syscall/proc.rs index 9f3c97c..362aef0 100644 --- a/kernel/src/syscall/proc.rs +++ b/kernel/src/syscall/proc.rs @@ -124,7 +124,7 @@ pub fn sys_exec( envp: *const *const u8, tf: &mut TrapFrame, ) -> SysResult { - info!("exec: name: {:?}, argv: {:?} envp: {:?}", name, argv, envp); + info!("exec: name: {:?}, argv: {:?}, envp: {:?}", name, argv, envp); let proc = process(); let exec_name = if name.is_null() { String::from("") @@ -165,7 +165,7 @@ pub fn sys_exec( } info!( - "EXEC: name:{:?} , args {:?}, envp {:?}", + "exec: name: {:?}, args: {:?}, envp: {:?}", exec_name, args, envs );