From: John Hodge Date: Thu, 22 Jul 2010 13:11:15 +0000 (+0800) Subject: Changing syscall interface to jump to KUSER_CODE, allowing use X-Git-Tag: rel0.06~91 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=e7fb36caedf6cd739359e98a163041b6e058ce7a;p=tpg%2Facess2.git Changing syscall interface to jump to KUSER_CODE, allowing use of SYSENTER/SYSCALL instead of int 0x80 to be selected at runtime - Also moved timer start earlier in startup --- diff --git a/Kernel/arch/x86/main.c b/Kernel/arch/x86/main.c index f9e70e5c..0557760e 100644 --- a/Kernel/arch/x86/main.c +++ b/Kernel/arch/x86/main.c @@ -81,13 +81,13 @@ int kmain(Uint MbMagic, void *MbInfoPtr) MM_InstallVirtual(); // Clean up virtual address space Heap_Install(); // Create initial heap + // Start Timers + Time_Setup(); + //Log_Log("Arch", "Starting Multitasking..."); // Start Multitasking Threads_Init(); - // Start Timers - Time_Setup(); - Log_Log("Arch", "Starting VFS..."); // Load Virtual Filesystem VFS_Init(); diff --git a/Kernel/arch/x86/proc.asm b/Kernel/arch/x86/proc.asm index cefd7963..fd863a42 100644 --- a/Kernel/arch/x86/proc.asm +++ b/Kernel/arch/x86/proc.asm @@ -236,6 +236,12 @@ GetCPUNum: ; Usermode code exported by the kernel [section .usertext] +; Export a place for the user to jump to to call a syscall +; - Allows the kernel to change the method easily +User_Syscall: + int 0xAC + +; A place to return to and exit User_Syscall_RetAndExit: push eax call User_Syscall_Exit diff --git a/Kernel/include/syscalls.h b/Kernel/include/syscalls.h index a9d88925..45e3b196 100644 --- a/Kernel/include/syscalls.h +++ b/Kernel/include/syscalls.h @@ -46,18 +46,20 @@ enum eSyscalls { SYS_READ, // 67 - Read from an open file SYS_WRITE, // 68 - Write to an open file SYS_IOCTL, // 69 - Perform an IOCtl Call - SYS_READDIR, // 70 - Read from an open directory - SYS_OPENCHILD, // 71 - Open a child entry in a directory - SYS_MKDIR, // 72 - Create a new directory - SYS_SYMLINK, // 73 - Create a symbolic link - SYS_GETACL, // 74 - Get an ACL Value - SYS_SETACL, // 75 - Set an ACL Value - SYS_FINFO, // 76 - Get file information - SYS_SEEK, // 77 - Seek to a new position in the file - SYS_TELL, // 78 - Return the current file position - SYS_CHDIR, // 79 - Change current directory - SYS_GETCWD, // 80 - Get current directory - SYS_MOUNT, // 81 - Mount a filesystem + SYS_SEEK, // 70 - Seek to a new position in the file + SYS_READDIR, // 71 - Read from an open directory + SYS_OPENCHILD, // 72 - Open a child entry in a directory + SYS_GETACL, // 73 - Get an ACL Value + SYS_SETACL, // 74 - Set an ACL Value + SYS_FINFO, // 75 - Get file information + SYS_MKDIR, // 76 - Create a new directory + SYS_LINK, // 77 - Create a new link to a file + SYS_SYMLINK, // 78 - Create a symbolic link + SYS_UNLINK, // 79 - Delete a file + SYS_TELL, // 80 - Return the current file position + SYS_CHDIR, // 81 - Change current directory + SYS_GETCWD, // 82 - Get current directory + SYS_MOUNT, // 83 - Mount a filesystem NUM_SYSCALLS, SYS_DEBUG = 0x100 // 0x100 - Print a debug string }; @@ -74,8 +76,9 @@ static const char *cSYSCALL_NAMES[] = { "","","","","","", "","","","","","", "","","","","SYS_OPEN","SYS_REOPEN", - "SYS_CLOSE","SYS_READ","SYS_WRITE","SYS_IOCTL","SYS_READDIR","SYS_OPENCHILD", - "SYS_MKDIR","SYS_SYMLINK","SYS_GETACL","SYS_SETACL","SYS_FINFO","SYS_SEEK", - "SYS_TELL","SYS_CHDIR","SYS_GETCWD","SYS_MOUNT","" + "SYS_CLOSE","SYS_READ","SYS_WRITE","SYS_IOCTL","SYS_SEEK","SYS_READDIR", + "SYS_OPENCHILD","SYS_GETACL","SYS_SETACL","SYS_FINFO","SYS_MKDIR","SYS_LINK", + "SYS_SYMLINK","SYS_UNLINK","SYS_TELL","SYS_CHDIR","SYS_GETCWD","SYS_MOUNT", + "" }; #endif diff --git a/Kernel/include/syscalls.inc.asm b/Kernel/include/syscalls.inc.asm index 7f37969f..c0435ccf 100644 --- a/Kernel/include/syscalls.inc.asm +++ b/Kernel/include/syscalls.inc.asm @@ -42,15 +42,17 @@ %define SYS_READ 67 ; Read from an open file %define SYS_WRITE 68 ; Write to an open file %define SYS_IOCTL 69 ; Perform an IOCtl Call -%define SYS_READDIR 70 ; Read from an open directory -%define SYS_OPENCHILD 71 ; Open a child entry in a directory -%define SYS_MKDIR 72 ; Create a new directory -%define SYS_SYMLINK 73 ; Create a symbolic link -%define SYS_GETACL 74 ; Get an ACL Value -%define SYS_SETACL 75 ; Set an ACL Value -%define SYS_FINFO 76 ; Get file information -%define SYS_SEEK 77 ; Seek to a new position in the file -%define SYS_TELL 78 ; Return the current file position -%define SYS_CHDIR 79 ; Change current directory -%define SYS_GETCWD 80 ; Get current directory -%define SYS_MOUNT 81 ; Mount a filesystem +%define SYS_SEEK 70 ; Seek to a new position in the file +%define SYS_READDIR 71 ; Read from an open directory +%define SYS_OPENCHILD 72 ; Open a child entry in a directory +%define SYS_GETACL 73 ; Get an ACL Value +%define SYS_SETACL 74 ; Set an ACL Value +%define SYS_FINFO 75 ; Get file information +%define SYS_MKDIR 76 ; Create a new directory +%define SYS_LINK 77 ; Create a new link to a file +%define SYS_SYMLINK 78 ; Create a symbolic link +%define SYS_UNLINK 79 ; Delete a file +%define SYS_TELL 80 ; Return the current file position +%define SYS_CHDIR 81 ; Change current directory +%define SYS_GETCWD 82 ; Get current directory +%define SYS_MOUNT 83 ; Mount a filesystem diff --git a/Kernel/syscalls.lst b/Kernel/syscalls.lst index dde278cd..cf299eaa 100644 --- a/Kernel/syscalls.lst +++ b/Kernel/syscalls.lst @@ -47,14 +47,16 @@ SYS_CLOSE Close a file SYS_READ Read from an open file SYS_WRITE Write to an open file SYS_IOCTL Perform an IOCtl Call +SYS_SEEK Seek to a new position in the file SYS_READDIR Read from an open directory SYS_OPENCHILD Open a child entry in a directory -SYS_MKDIR Create a new directory -SYS_SYMLINK Create a symbolic link SYS_GETACL Get an ACL Value SYS_SETACL Set an ACL Value SYS_FINFO Get file information -SYS_SEEK Seek to a new position in the file +SYS_MKDIR Create a new directory +SYS_LINK Create a new link to a file +SYS_SYMLINK Create a symbolic link +SYS_UNLINK Delete a file SYS_TELL Return the current file position SYS_CHDIR Change current directory SYS_GETCWD Get current directory diff --git a/Usermode/Libraries/libacess.so_src/syscalls.inc.asm b/Usermode/Libraries/libacess.so_src/syscalls.inc.asm index c6e11df0..8e4e26a3 100644 --- a/Usermode/Libraries/libacess.so_src/syscalls.inc.asm +++ b/Usermode/Libraries/libacess.so_src/syscalls.inc.asm @@ -4,13 +4,15 @@ %include "../../../Kernel/include/syscalls.inc.asm" +SYSCALL_JUMP equ 0xCFFF0000 + ; System Call - No Arguments %macro SYSCALL0 2 [global %1:func] %1: push ebx mov eax, %2 - int 0xAC + jmp SYSCALL_JUMP mov [_errno], ebx pop ebx ret @@ -25,7 +27,7 @@ push ebx mov eax, %2 mov ebx, [ebp+8] - int 0xAC + jmp SYSCALL_JUMP mov [_errno], ebx pop ebx pop ebp @@ -42,7 +44,7 @@ mov eax, %2 mov ebx, [ebp+8] mov ecx, [ebp+12] - int 0xAC + jmp SYSCALL_JUMP mov [_errno], ebx pop ebx pop ebp @@ -60,7 +62,7 @@ mov ebx, [ebp+8] mov ecx, [ebp+12] mov edx, [ebp+16] - int 0xAC + jmp SYSCALL_JUMP mov [_errno], ebx pop ebx pop ebp @@ -80,7 +82,7 @@ mov ecx, [ebp+12] mov edx, [ebp+16] mov edi, [ebp+20] - int 0xAC + jmp SYSCALL_JUMP mov [_errno], ebx pop edi pop ebx @@ -103,7 +105,7 @@ mov edx, [ebp+16] mov edi, [ebp+20] mov esi, [ebp+24] - int 0xAC + jmp SYSCALL_JUMP mov [_errno], ebx pop esi pop edi @@ -128,7 +130,7 @@ mov edi, [ebp+20] mov esi, [ebp+24] mov ebp, [ebp+28] - int 0xAC + jmp SYSCALL_JUMP mov [_errno], ebx pop esi pop edi