diff options
Diffstat (limited to 'i386/i386/thread.h')
-rw-r--r-- | i386/i386/thread.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/i386/i386/thread.h b/i386/i386/thread.h index 4a9c1987..9c88d09a 100644 --- a/i386/i386/thread.h +++ b/i386/i386/thread.h @@ -51,10 +51,12 @@ */ struct i386_saved_state { +#if !defined(__x86_64__) || defined(USER32) unsigned long gs; unsigned long fs; unsigned long es; unsigned long ds; +#endif #ifdef __x86_64__ unsigned long r15; unsigned long r14; @@ -81,12 +83,14 @@ struct i386_saved_state { unsigned long efl; unsigned long uesp; unsigned long ss; +#if !defined(__x86_64__) || defined(USER32) struct v86_segs { unsigned long v86_es; /* virtual 8086 segment registers */ unsigned long v86_ds; unsigned long v86_fs; unsigned long v86_gs; } v86_segs; +#endif }; /* @@ -140,6 +144,7 @@ struct i386_fpsave_state { }; }; +#if !defined(__x86_64__) || defined(USER32) /* * v86_assist_state: * @@ -153,6 +158,14 @@ struct v86_assist_state { unsigned short flags; /* 8086 flag bits */ }; #define V86_IF_PENDING 0x8000 /* unused bit */ +#endif + +#if defined(__x86_64__) && !defined(USER32) +struct i386_segment_base_state { + unsigned long fsbase; + unsigned long gsbase; +}; +#endif /* * i386_interrupt_state: @@ -163,10 +176,12 @@ struct v86_assist_state { */ struct i386_interrupt_state { +#if !defined(__x86_64__) || defined(USER32) long gs; long fs; long es; long ds; +#endif #ifdef __x86_64__ long r11; long r10; @@ -193,14 +208,28 @@ struct i386_interrupt_state { struct i386_machine_state { struct user_ldt * ldt; struct i386_fpsave_state *ifps; +#if !defined(__x86_64__) || defined(USER32) struct v86_assist_state v86s; +#endif struct real_descriptor user_gdt[USER_GDT_SLOTS]; struct i386_debug_state ids; +#if defined(__x86_64__) && !defined(USER32) + struct i386_segment_base_state sbs; +#endif }; typedef struct pcb { + /* START of the exception stack. + * NOTE: this area is used as exception stack when switching + * CPL, and it MUST be big enough to save the thread state and + * switch to a proper stack area, even considering recursive + * exceptions, otherwise it could corrupt nearby memory */ struct i386_interrupt_state iis[2]; /* interrupt and NMI */ +#ifdef __x86_64__ + unsigned long pad; /* ensure exception stack is aligned to 16 */ +#endif struct i386_saved_state iss; + /* END of exception stack*/ struct i386_machine_state ims; decl_simple_lock_data(, lock) unsigned short init_control; /* Initial FPU control to set */ @@ -222,6 +251,19 @@ typedef struct pcb { #define STACK_IEL(stack) \ ((struct i386_exception_link *)STACK_IKS(stack) - 1) +#ifdef __x86_64__ +#define KERNEL_STACK_ALIGN 16 +#else +#define KERNEL_STACK_ALIGN 4 +#endif + +#if defined(__x86_64__) && !defined(USER32) +/* Follow System V AMD64 ABI guidelines. */ +#define USER_STACK_ALIGN 16 +#else +#define USER_STACK_ALIGN 4 +#endif + #define USER_REGS(thread) (&(thread)->pcb->iss) |