SYSENTER/SYSCALL support

. add cpufeature detection of both
	. use it for both ipc and kernelcall traps, using a register
	  for call number
	. SYSENTER/SYSCALL does not save any context, therefore userland
	  has to save it
	. to accomodate multiple kernel entry/exit types, the entry
	  type is recorded in the process struct. hitherto all types
	  were interrupt (soft int, exception, hard int); now SYSENTER/SYSCALL
	  is new, with the difference that context is not fully restored
	  from proc struct when running the process again. this can't be
	  done as some information is missing.
	. complication: cases in which the kernel has to fully change
	  process context (i.e. sigreturn). in that case the exit type
	  is changed from SYSENTER/SYSEXIT to soft-int (i.e. iret) and
	  context is fully restored from the proc struct. this does mean
	  the PC and SP must change, as the sysenter/sysexit userland code
	  will otherwise try to restore its own context. this is true in the
	  sigreturn case.
	. override all usage by setting libc_ipc=1
This commit is contained in:
Ben Gras
2012-06-10 17:50:17 +00:00
parent 629829e69c
commit 2d72cbec41
38 changed files with 643 additions and 79 deletions

View File

@@ -33,6 +33,7 @@ typedef struct segframe {
reg_t p_cr3; /* page table root */
u32_t *p_cr3_v;
char *fpu_state;
int p_kern_trap_style;
} segframe_t;
struct cpu_info {

View File

@@ -218,6 +218,13 @@
#ifdef __minix
#define IMPORT(sym) \
.extern _C_LABEL(sym)
#define KERVEC_ORIG 32 /* syscall trap to kernel */
#define IPCVEC_ORIG 33 /* ipc trap to kernel */
#define KERVEC_UM 34 /* syscall trap to kernel, user-mapped code */
#define IPCVEC_UM 35 /* ipc trap to kernel, user-mapped code */
#endif
#endif /* !_I386_ASM_H_ */

View File

@@ -25,8 +25,10 @@
#define OVERFLOW_VECTOR 4 /* from INTO */
/* Fixed system call vector. */
#define KERN_CALL_VECTOR 32 /* system calls are made with int SYSVEC */
#define IPC_VECTOR 33 /* interrupt vector for ipc */
#define KERN_CALL_VECTOR_ORIG 32 /* system calls are made with int SYSVEC */
#define IPC_VECTOR_ORIG 33 /* interrupt vector for ipc */
#define KERN_CALL_VECTOR_UM 34 /* user-mapped equivalent */
#define IPC_VECTOR_UM 35 /* user-mapped equivalent */
/* Hardware interrupt numbers. */
#ifndef USE_APIC

View File

@@ -73,6 +73,7 @@ i386/vm.h
/* CPUID flags */
#define CPUID1_EDX_FPU (1L) /* FPU presence */
#define CPUID1_EDX_PSE (1L << 3) /* Page Size Extension */
#define CPUID1_EDX_SYSENTER (1L << 11) /* Intel SYSENTER */
#define CPUID1_EDX_PGE (1L << 13) /* Page Global (bit) Enable */
#define CPUID1_EDX_APIC_ON_CHIP (1L << 9) /* APIC is present on the chip */
#define CPUID1_EDX_TSC (1L << 4) /* Timestamp counter present */
@@ -85,6 +86,8 @@ i386/vm.h
#define CPUID1_ECX_SSE4_1 (1L << 19)
#define CPUID1_ECX_SSE4_2 (1L << 20)
#define CPUID_EF_EDX_SYSENTER (1L << 11) /* Intel SYSENTER */
#ifndef __ASSEMBLY__
#include <minix/type.h>