From 8494bf9b0c146200f17652e68a0ef7e4752870b3 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Fri, 19 Apr 2019 12:34:27 +0800 Subject: [PATCH] Fix sys_sendfile args --- kernel/src/arch/x86_64/gdt.rs | 29 ++++----- kernel/src/process/mod.rs | 112 ++++++++++++++++++++++++---------- kernel/src/syscall/mod.rs | 2 +- 3 files changed, 94 insertions(+), 49 deletions(-) diff --git a/kernel/src/arch/x86_64/gdt.rs b/kernel/src/arch/x86_64/gdt.rs index 90e5037..ed648e3 100644 --- a/kernel/src/arch/x86_64/gdt.rs +++ b/kernel/src/arch/x86_64/gdt.rs @@ -17,22 +17,19 @@ pub fn init() { static mut CPUS: [Option; MAX_CPU_NUM] = [ // TODO: More elegant ? - None, None, None, None, None, None, None, None, - None, None, None, None, None, None, None, None, - None, None, None, None, None, None, None, None, - None, None, None, None, None, None, None, None, - None, None, None, None, None, None, None, None, - None, None, None, None, None, None, None, None, - None, None, None, None, None, None, None, None, - None, None, None, None, None, None, None, None, -// None, None, None, None, None, None, None, None, -// None, None, None, None, None, None, None, None, -// None, None, None, None, None, None, None, None, -// None, None, None, None, None, None, None, None, -// None, None, None, None, None, None, None, None, -// None, None, None, None, None, None, None, None, -// None, None, None, None, None, None, None, None, -// None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, + None, + // None, None, None, None, None, None, None, None, + // None, None, None, None, None, None, None, None, + // None, None, None, None, None, None, None, None, + // None, None, None, None, None, None, None, None, + // None, None, None, None, None, None, None, None, + // None, None, None, None, None, None, None, None, + // None, None, None, None, None, None, None, None, + // None, None, None, None, None, None, None, None, ]; pub struct Cpu { diff --git a/kernel/src/process/mod.rs b/kernel/src/process/mod.rs index fca611d..516d29e 100644 --- a/kernel/src/process/mod.rs +++ b/kernel/src/process/mod.rs @@ -27,38 +27,86 @@ pub fn init() { static PROCESSORS: [Processor; MAX_CPU_NUM] = [ // TODO: More elegant ? - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), - Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), -// Processor::new(), Processor::new(), Processor::new(), Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), + // Processor::new(), Processor::new(), Processor::new(), Processor::new(), ]; /// Get current process diff --git a/kernel/src/syscall/mod.rs b/kernel/src/syscall/mod.rs index aaf9b9f..046bd71 100644 --- a/kernel/src/syscall/mod.rs +++ b/kernel/src/syscall/mod.rs @@ -88,7 +88,7 @@ pub fn syscall(id: usize, args: [usize; 6], tf: &mut TrapFrame) -> isize { } SYS_GETPID => sys_getpid(), // 40 - SYS_SENDFILE => sys_sendfile(args[0], args[1], args[3] as *mut usize, args[4]), + SYS_SENDFILE => sys_sendfile(args[0], args[1], args[2] as *mut usize, args[3]), SYS_SOCKET => sys_socket(args[0], args[1], args[2]), SYS_CONNECT => sys_connect(args[0], args[1] as *const SockAddr, args[2]), SYS_ACCEPT => sys_accept(args[0], args[1] as *mut SockAddr, args[2] as *mut u32),