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:
@@ -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 {
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -629,6 +629,7 @@
|
||||
#define VMCTL_VMINHIBIT_SET 30
|
||||
#define VMCTL_VMINHIBIT_CLEAR 31
|
||||
#define VMCTL_CLEARMAPCACHE 32
|
||||
#define VMCTL_BOOTINHIBIT_CLEAR 33
|
||||
|
||||
/* Codes and field names for SYS_SYSCTL. */
|
||||
#define SYSCTL_CODE m1_i1 /* SYSCTL_CODE_* below */
|
||||
|
||||
@@ -173,4 +173,8 @@
|
||||
/* magic value to put in struct proc entries for sanity checks. */
|
||||
#define PMAGIC 0xC0FFEE1
|
||||
|
||||
/* MINIX_KERNFLAGS flags */
|
||||
#define MKF_I386_INTEL_SYSENTER (1L << 0) /* SYSENTER available and supported */
|
||||
#define MKF_I386_AMD_SYSCALL (1L << 1) /* SYSCALL available and supported */
|
||||
|
||||
#endif /* _MINIX_CONST_H */
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
#define _CPUF_I386_HTT 13 /* Supports HTT */
|
||||
#define _CPUF_I386_HTT_MAX_NUM 14 /* Maximal num of threads */
|
||||
|
||||
#define _CPUF_I386_MTRR 15
|
||||
#define _CPUF_I386_SYSENTER 16 /* Intel SYSENTER instrs */
|
||||
#define _CPUF_I386_SYSCALL 17 /* AMD SYSCALL instrs */
|
||||
|
||||
int _cpufeature(int featureno);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#endif
|
||||
#include <minix/ipcconst.h>
|
||||
#include <minix/type.h>
|
||||
#include <minix/const.h>
|
||||
|
||||
/*==========================================================================*
|
||||
* Types relating to messages. *
|
||||
@@ -152,24 +153,37 @@ typedef struct asynmsg
|
||||
#define AMF_NOTIFY_ERR 020 /* Send a notification when AMF_DONE is set and
|
||||
* delivery of the message failed */
|
||||
|
||||
/* Hide names to avoid name space pollution. */
|
||||
#define echo _echo
|
||||
#define notify _notify
|
||||
#define sendrec _sendrec
|
||||
#define receive _receive
|
||||
#define send _send
|
||||
#define sendnb _sendnb
|
||||
#define senda _senda
|
||||
int _send_orig(endpoint_t dest, message *m_ptr);
|
||||
int _receive_orig(endpoint_t src, message *m_ptr, int *status_ptr);
|
||||
int _sendrec_orig(endpoint_t src_dest, message *m_ptr);
|
||||
int _sendnb_orig(endpoint_t dest, message *m_ptr);
|
||||
int _notify_orig(endpoint_t dest);
|
||||
int _senda_orig(asynmsg_t *table, size_t count);
|
||||
int _do_kernel_call_orig(message *m_ptr);
|
||||
|
||||
int echo(message *m_ptr);
|
||||
int notify(endpoint_t dest);
|
||||
int sendrec(endpoint_t src_dest, message *m_ptr);
|
||||
int receive(endpoint_t src, message *m_ptr, int *status_ptr);
|
||||
int send(endpoint_t dest, message *m_ptr);
|
||||
int sendnb(endpoint_t dest, message *m_ptr);
|
||||
int senda(asynmsg_t *table, size_t count);
|
||||
int _minix_kernel_info_struct(struct minix_kerninfo **);
|
||||
|
||||
int _do_kernel_call(message *m_ptr);
|
||||
struct minix_ipcvecs {
|
||||
int (*send_ptr)(endpoint_t dest, message *m_ptr);
|
||||
int (*receive_ptr)(endpoint_t src, message *m_ptr, int *st);
|
||||
int (*sendrec_ptr)(endpoint_t src_dest, message *m_ptr);
|
||||
int (*sendnb_ptr)(endpoint_t dest, message *m_ptr);
|
||||
int (*notify_ptr)(endpoint_t dest);
|
||||
int (*do_kernel_call_ptr)(message *m_ptr);
|
||||
int (*senda_ptr)(asynmsg_t *table, size_t count);
|
||||
};
|
||||
|
||||
/* kernel-set IPC vectors retrieved by a constructor in libc/sys-minix/init.c */
|
||||
extern struct minix_ipcvecs _minix_ipcvecs;
|
||||
|
||||
#define CHOOSETRAP(name) (_minix_ipcvecs. name ## _ptr)
|
||||
|
||||
#define send CHOOSETRAP(send)
|
||||
#define receive CHOOSETRAP(receive)
|
||||
#define sendrec CHOOSETRAP(sendrec)
|
||||
#define sendnb CHOOSETRAP(sendnb)
|
||||
#define notify CHOOSETRAP(notify)
|
||||
#define do_kernel_call CHOOSETRAP(do_kernel_call)
|
||||
#define senda CHOOSETRAP(senda)
|
||||
|
||||
#endif /* _IPC_H */
|
||||
|
||||
@@ -168,8 +168,8 @@ struct minix_kerninfo {
|
||||
*/
|
||||
#define KERNINFO_MAGIC 0xfc3b84bf
|
||||
u32_t kerninfo_magic;
|
||||
u32_t minix_feature_flags;
|
||||
u32_t flags_unused1;
|
||||
u32_t minix_feature_flags; /* features in minix kernel */
|
||||
u32_t ki_flags; /* what is present in this struct */
|
||||
u32_t flags_unused2;
|
||||
u32_t flags_unused3;
|
||||
u32_t flags_unused4;
|
||||
@@ -177,7 +177,10 @@ struct minix_kerninfo {
|
||||
struct machine *machine;
|
||||
struct kmessages *kmessages;
|
||||
struct loadinfo *loadinfo;
|
||||
struct minix_ipcvecs *minix_ipcvecs;
|
||||
} __packed;
|
||||
|
||||
#define MINIX_KIF_IPCVECS (1L << 0)
|
||||
|
||||
#endif /* _TYPE_H */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user