Merged
Conversation
fslongjin
reviewed
Oct 26, 2023
kernel/src/futex/constant.rs
Outdated
|
|
||
| #[allow(dead_code)] | ||
| pub mod define { | ||
| pub const FUTEX_WAIT: u32 = 0; |
kernel/src/arch/x86_64/rand.rs
Outdated
| } | ||
|
|
||
| bitflags! { | ||
| pub struct GRandFlags: u8{ |
fslongjin
reviewed
Oct 26, 2023
kernel/src/filesystem/vfs/syscall.rs
Outdated
|
|
||
| fn do_stat(path: &str) -> Result<PosixKstat, SystemError> { | ||
| // 文件名过长 | ||
| if path.len() > MAX_PATHLEN as usize { |
fslongjin
requested changes
Oct 26, 2023
Comment on lines
+293
to
+294
| child_trapframe.rbp = usp.data() as u64 + 11 * core::mem::size_of::<usize>() as u64; | ||
| child_trapframe.rsp = usp.data() as u64; |
| arg2: usize, | ||
| from_user: bool, | ||
| ) -> Result<usize, SystemError> { | ||
| let mut arch_info = pcb.arch_info(); |
kernel/src/syscall/mod.rs
Outdated
| let uaddr2 = args[4] as *const u32; | ||
| let val3 = args[5] as u32; | ||
|
|
||
| let mut timespec: *mut TimeSpec = core::ptr::null::<TimeSpec>() as *mut TimeSpec; |
Member
There was a problem hiding this comment.
这里有内存越界问题,应当写成
let mut timespec = TimeSpec::default();
这样才有充足的空间。
另外,这里的所有裸指针最好都进行检验,能够拷贝的小的参数都先拷贝了。
| } | ||
|
|
||
| #[derive(Debug)] | ||
| pub enum Provider { |
kernel/src/process/fork.rs
Outdated
|
|
||
| // TODO: 处理CLONE_PARENT 与 SIGNAL_UNKILLABLE的情况 | ||
|
|
||
| // 如果新进程使用不同的 pid 或用户名空间, |
kernel/src/syscall/mod.rs
Outdated
| unimplemented!() | ||
| } | ||
|
|
||
| SYS_POLL => Ok(0), |
kernel/src/time/timer.rs
Outdated
| fn run(&self) { | ||
| let r = self.0.lock().timer_func.run(); | ||
| let mut timer = self.0.lock(); | ||
| timer.timeout = true; |
kernel/src/futex/futex.rs
Outdated
| let mut address = uaddr as u64; | ||
|
|
||
| // 计算相对页的偏移量 | ||
| let offset = address % MMArch::PAGE_SIZE as u64; |
Member
There was a problem hiding this comment.
改为位运算address & (MMArch::PAGE_SIZE -1)
kernel/src/futex/futex.rs
Outdated
| use super::constant::*; | ||
|
|
||
| lazy_static! { | ||
| pub(super) static ref FUTEX_DATA: SpinLock<HashMap<FutexKey, LockedFutexHashBucket>> = |
Member
There was a problem hiding this comment.
用了全局锁的话,里面LockedFutexHashBucket就不需要lock的了,因为它不是多进程/线程共享
| pub fn cancel(&self) -> bool { | ||
| TIMER_LIST | ||
| .lock() | ||
| .drain_filter(|x| Arc::<Timer>::as_ptr(&x) == self as *const Timer); |
fslongjin
reviewed
Oct 29, 2023
kernel/src/process/mod.rs
Outdated
| // 将user_tid_addr置0 | ||
| if thread.clear_child_tid.is_some() { | ||
| let _ = | ||
| unsafe { clear_user(thread.clear_child_tid.unwrap(), core::mem::size_of::<i32>()) }; |
Member
There was a problem hiding this comment.
这个应该是要在线程的exit的地方执行,而不是这个drop函数
Suggested change
| unsafe { clear_user(thread.clear_child_tid.unwrap(), core::mem::size_of::<i32>()) }; | |
| unsafe { clear_user(thread.clear_child_tid.unwrap(), core::mem::size_of::<i32>()) }; |
* 添加rust重构版本的HPET驱动和tsc驱动,并使用HPET校准tsc频率和cpu总线频率 * 把hpet.c移动到arch文件夹下
7cb7d23 to
e8db16b
Compare
* 测试RESET * 测试RESET * 基于轮询的实现 * 规范化部分unsafe的使用 * 完成中断处理函数,同时去除了不必要的内存拷贝行为,准备编写napi机制 * 实现现有协议栈下的部分napi机制;修复了内存泄漏的问题;添加了一部分代码注释 * 去除部分无用代码 * 去除一些无用代码 * 适配新的驱动模型 * 完成msi中断测试 * 去除一些无用代码 * 格式化代码 * 增加了一些注释,提高代码可读性 * 去除无关文件 * 优化了读取mac地址的方式,提高可读性
fslongjin
approved these changes
Nov 1, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
主要
次要
为了适配musl,实现了一下几个系统调用
BUG修复