From a4a71f89713c34454ef254bbb1a1ea9ed773fa1b Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 4 Jul 2010 11:28:31 +0800 Subject: [PATCH] Added current time syscall, commented some others --- Kernel/syscalls.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Kernel/syscalls.c b/Kernel/syscalls.c index e6e828e3..02b9008a 100644 --- a/Kernel/syscalls.c +++ b/Kernel/syscalls.c @@ -120,14 +120,18 @@ void SyscallHandler(tSyscallRegs *Regs) // -- Check for messages case SYS_GETMSG: CHECK_NUM_NULLOK(Regs->Arg1, sizeof(Uint)); - if( Regs->Arg2 && Regs->Arg2 != -1 && !MM_IsUser(Regs->Arg2) ) - { + if( Regs->Arg2 && Regs->Arg2 != -1 && !MM_IsUser(Regs->Arg2) ) { err = -EINVAL; ret = -1; break; } // *Source, *Data ret = Proc_GetMessage(&err, (Uint*)Regs->Arg1, (void*)Regs->Arg2); break; + // -- Get the current timestamp + case SYS_GETTIME: + ret = now(); + break; + // -- Set the thread's name case SYS_SETNAME: CHECK_STR_NONULL(Regs->Arg1); @@ -137,9 +141,10 @@ void SyscallHandler(tSyscallRegs *Regs) // --- // Binary Control // --- + // -- Replace the current process with another case SYS_EXECVE: CHECK_STR_NONULL(Regs->Arg1); - //Log(" Regs = {Arg2: %x, Arg3: %x}", Regs->Arg2, Regs->Arg3); + // Check the argument arrays { int i; char **tmp = (char**)Regs->Arg2; @@ -166,6 +171,7 @@ void SyscallHandler(tSyscallRegs *Regs) // Path, **Argv, **Envp ret = Proc_Execve((char*)Regs->Arg1, (char**)Regs->Arg2, (char**)Regs->Arg3); break; + // -- Load a binary into the current process case SYS_LOADBIN: if( !Syscall_ValidString(Regs->Arg1) || !Syscall_Valid(sizeof(Uint), Regs->Arg2) ) { -- 2.20.1