Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(net): the big network rebuild #977

Draft
wants to merge 61 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
40d9375
ready for merge in master (#964)
Samuka007 Oct 10, 2024
4e4ce68
updates uevent and make fmt
val213 Oct 11, 2024
178486f
新增CommonAttrGroup,基本支持sysfs下各种类型设备的uevent属性文件的读测试
val213 Oct 13, 2024
e67348c
修改net设备的uevent内容,使之与Linux语义一致
val213 Oct 13, 2024
49000bc
删除无用注释
val213 Oct 14, 2024
38d161c
feat: 支持 sysfs下 block, char, Net, rtc, tty 等类型设备的 uevent 文件读操作 (#973)
val213 Oct 14, 2024
b781eaa
Merge remote-tracking branch 'upstream/feat-network-rebuild' into uev…
val213 Oct 14, 2024
2e98aea
Merge remote-tracking branch 'upstream/feat-network-rebuild' into fea…
Samuka007 Oct 14, 2024
7cebb88
can ctrl-c interupt from blocking accept
Samuka007 Oct 14, 2024
8fe49e1
make fmt
Samuka007 Oct 14, 2024
bca536e
clean debug messages
Samuka007 Oct 14, 2024
9a1fe0f
Merge pull request #974 from Samuka007:feat-network-rebuild
Samuka007 Oct 14, 2024
63ccb53
merge master
Samuka007 Oct 14, 2024
91f24d4
Merge pull request #976 from Samuka007/feat-network-rebuild
Samuka007 Oct 14, 2024
d7be7de
清理积弊,不必要的动态分发和智能指针
val213 Oct 15, 2024
4a2b593
remove uevent and netlink
val213 Oct 16, 2024
7025b76
fmt
val213 Oct 16, 2024
b9f04fc
merge upstream
val213 Oct 16, 2024
886504f
remove uevent test
val213 Oct 16, 2024
10e62c7
Merge pull request #980 from val213/feat-network-rebuild
Samuka007 Oct 16, 2024
4736fad
重新组织代码分布
Samuka007 Oct 16, 2024
ce8026c
merge upstream/net
Samuka007 Oct 16, 2024
de148a1
remove unused imports
Samuka007 Oct 16, 2024
b9f27f4
fix it back to old syscall printing style
Samuka007 Oct 17, 2024
ddad6b1
regulate naming to posix
Samuka007 Oct 17, 2024
251e1bc
todo: socket close 及 port 接触占用
Samuka007 Oct 17, 2024
6c812d2
fix: format check
Samuka007 Oct 17, 2024
7cd11b4
feat: remove syscall prettier printing (#988)
Samuka007 Oct 17, 2024
149fc83
remove unnecessary warnings and impls
Samuka007 Oct 17, 2024
c9806be
loopback assign single ip, remove unnecessary comments
Samuka007 Oct 17, 2024
acd3485
fmt
Samuka007 Oct 17, 2024
954dd0a
Merge remote-tracking branch 'upstream/feat-network-rebuild'
Samuka007 Oct 17, 2024
7ead4a0
Merge pull request #992 from Samuka007/feat-network-rebuild
Samuka007 Oct 17, 2024
15cedf3
去除virtio_blk, virtio_net expect错误处理,直接返回错误
1037827920 Oct 17, 2024
bb23a04
Merge pull request #995 from 1037827920/patch-fix-virtio_error_handle
Samuka007 Oct 17, 2024
acfceaa
fix: 修复网卡顺序的bug (#996)
smallcjy Oct 20, 2024
a303dd0
fix: ipv6, AddressFamily有转换问题。
Samuka007 Oct 21, 2024
e0c7255
Merge remote-tracking branch 'upstream/feat-network-rebuild' into fea…
Samuka007 Oct 21, 2024
bca5197
make fmt
Samuka007 Oct 21, 2024
8189cb1
Merge pull request #1004 from Samuka007/feat-network-rebuild
Samuka007 Oct 21, 2024
fad1c09
feat(net): 实现unix抽象地址空间 (#1017)
smallcjy Oct 28, 2024
055c144
feat(doc):添加网络子系统模块 (#1020)
smallcjy Oct 30, 2024
ff13f9f
fix(net): TCP Resources and add syscall print, change to use latest s…
Samuka007 Nov 7, 2024
2b180c4
debug and add socket option level print
Samuka007 Nov 8, 2024
4e8c71b
fix: fix udp and run dog in udp
smallcjy Nov 11, 2024
7411864
Merge pull request #1041 from smallcjy:fix-udp
Samuka007 Nov 13, 2024
d675513
Merge branch 'DragonOS-Community:feat-network-rebuild' into feat-netw…
Samuka007 Nov 13, 2024
aaf9a5f
turn off syscall printing, remove unused imports and make fmt
Samuka007 Nov 13, 2024
e4115c9
turn off syscall printings
Samuka007 Nov 13, 2024
1a04676
merge main
Samuka007 Nov 13, 2024
bd5f713
Merge pull request #1048 from Samuka007/feat-network-rebuild
Samuka007 Nov 15, 2024
f438808
纸糊忙等tcp connecting,尚不明确连接可用的机制。
Samuka007 Nov 20, 2024
dab9a7a
turn off syscall
Samuka007 Nov 20, 2024
14c2143
Merge branch 'master' into feat-network-rebuild
fslongjin Nov 27, 2024
b749598
fix: 修正IfaceCommon的bounds字段的锁使用问题&调度问题
fslongjin Nov 27, 2024
57e0b2e
feat(socket): 实现shutdown系统调用的基础结构并启用相关方法
xiaolin2004 Nov 28, 2024
bbea79e
feat(socket): 添加shutdown方法并实现ShutdownTemp的TryFrom转换
xiaolin2004 Nov 28, 2024
0896c33
Merge pull request #1064 from fslongjin:patch-fix-a-locking-problem
Samuka007 Nov 28, 2024
b9c07e0
Merge remote-tracking branch 'origin/master' into patch-merge-master-…
fslongjin Nov 29, 2024
0e62017
fmt
fslongjin Nov 29, 2024
1848f09
Merge pull request #1068 from fslongjin/patch-merge-master-1129
fslongjin Nov 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 54 additions & 23 deletions kernel/src/arch/x86_64/syscall/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
arch::{
ipc::signal::X86_64SignalArch,
syscall::nr::{SYS_ARCH_PRCTL, SYS_RT_SIGRETURN},
syscall::nr::{SysCall, SYS_ARCH_PRCTL, SYS_RT_SIGRETURN},
CurrentIrqArch,
},
exception::InterruptArch,
Expand Down Expand Up @@ -53,7 +53,7 @@ macro_rules! syscall_return {

if $show {
let pid = ProcessManager::current_pcb().pid();
debug!("syscall return:pid={:?},ret= {:?}\n", pid, ret as isize);
debug!("[SYS] [Pid: {:?}] [Retn: {:?}]", pid, ret as i64);
}

unsafe {
Expand All @@ -63,6 +63,24 @@ macro_rules! syscall_return {
}};
}

macro_rules! normal_syscall_return {
($val:expr, $regs:expr, $show:expr) => {{
let ret = $val;

if $show {
let pid = ProcessManager::current_pcb().pid();
debug!("[SYS] [Pid: {:?}] [Retn: {:?}]", pid, ret);
}

$regs.rax = ret.unwrap_or_else(|e| e.to_posix_errno() as usize) as u64;

unsafe {
CurrentIrqArch::interrupt_disable();
}
return;
}};
}

#[no_mangle]
pub extern "sysv64" fn syscall_handler(frame: &mut TrapFrame) {
let syscall_num = frame.rax as usize;
Expand All @@ -87,15 +105,38 @@ pub extern "sysv64" fn syscall_handler(frame: &mut TrapFrame) {
];
mfence();
let pid = ProcessManager::current_pcb().pid();
let show = false;
// let show = if syscall_num != SYS_SCHED && pid.data() >= 7 {
// true
// } else {
// false
// };

if show {
debug!("syscall: pid: {:?}, num={:?}\n", pid, syscall_num);
let mut show = (syscall_num != SYS_SCHED) && (pid.data() >= 7);
// let mut show = true;

let to_print = SysCall::try_from(syscall_num);
if let Ok(to_print) = to_print {
use SysCall::*;
match to_print {
SYS_ACCEPT | SYS_ACCEPT4 | SYS_BIND | SYS_CONNECT | SYS_SHUTDOWN | SYS_LISTEN => {
show &= true;
}
SYS_RECVFROM | SYS_SENDTO | SYS_SENDMSG | SYS_RECVMSG => {
show &= true;
}
SYS_SOCKET | SYS_GETSOCKNAME | SYS_GETPEERNAME | SYS_SOCKETPAIR | SYS_SETSOCKOPT
| SYS_GETSOCKOPT => {
show &= true;
}
SYS_OPEN | SYS_OPENAT | SYS_CREAT | SYS_CLOSE => {
show &= true;
}
SYS_READ | SYS_WRITE | SYS_READV | SYS_WRITEV | SYS_PREAD64 | SYS_PWRITE64
| SYS_PREADV | SYS_PWRITEV | SYS_PREADV2 => {
show &= true;
}
_ => {
show &= false;
}
}
show &= false;
if show {
debug!("[SYS] [Pid: {:?}] [Call: {:?}]", pid, to_print);
}
}

// Arch specific syscall
Expand All @@ -108,21 +149,11 @@ pub extern "sysv64" fn syscall_handler(frame: &mut TrapFrame) {
);
}
SYS_ARCH_PRCTL => {
syscall_return!(
Syscall::arch_prctl(args[0], args[1])
.unwrap_or_else(|e| e.to_posix_errno() as usize),
frame,
show
);
normal_syscall_return!(Syscall::arch_prctl(args[0], args[1]), frame, show);
Samuka007 marked this conversation as resolved.
Show resolved Hide resolved
}
_ => {}
}
syscall_return!(
Syscall::handle(syscall_num, &args, frame).unwrap_or_else(|e| e.to_posix_errno() as usize)
as u64,
frame,
show
);
normal_syscall_return!(Syscall::handle(syscall_num, &args, frame), frame, show);
}

/// 系统调用初始化
Expand Down
Loading
Loading