mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 21:07:02 +09:00
x86: use generic register name in the thread and tss structures
This changes size-specific register names (eip/rip, esp/rsp, etc.) to generic names in the thread and tss structures. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
committed by
Ingo Molnar
parent
25149b62d3
commit
faca62273b
@@ -101,7 +101,7 @@ struct pv_cpu_ops {
|
||||
int entrynum, u32 low, u32 high);
|
||||
void (*write_idt_entry)(struct desc_struct *,
|
||||
int entrynum, u32 low, u32 high);
|
||||
void (*load_esp0)(struct tss_struct *tss, struct thread_struct *t);
|
||||
void (*load_sp0)(struct tss_struct *tss, struct thread_struct *t);
|
||||
|
||||
void (*set_iopl_mask)(unsigned mask);
|
||||
|
||||
@@ -449,10 +449,10 @@ static inline int paravirt_enabled(void)
|
||||
return pv_info.paravirt_enabled;
|
||||
}
|
||||
|
||||
static inline void load_esp0(struct tss_struct *tss,
|
||||
static inline void load_sp0(struct tss_struct *tss,
|
||||
struct thread_struct *thread)
|
||||
{
|
||||
PVOP_VCALL2(pv_cpu_ops.load_esp0, tss, thread);
|
||||
PVOP_VCALL2(pv_cpu_ops.load_sp0, tss, thread);
|
||||
}
|
||||
|
||||
#define ARCH_SETUP pv_init_ops.arch_setup();
|
||||
|
||||
@@ -292,20 +292,17 @@ struct thread_struct;
|
||||
/* This is the TSS defined by the hardware. */
|
||||
struct i386_hw_tss {
|
||||
unsigned short back_link,__blh;
|
||||
unsigned long esp0;
|
||||
unsigned long sp0;
|
||||
unsigned short ss0,__ss0h;
|
||||
unsigned long esp1;
|
||||
unsigned long sp1;
|
||||
unsigned short ss1,__ss1h; /* ss1 is used to cache MSR_IA32_SYSENTER_CS */
|
||||
unsigned long esp2;
|
||||
unsigned long sp2;
|
||||
unsigned short ss2,__ss2h;
|
||||
unsigned long __cr3;
|
||||
unsigned long eip;
|
||||
unsigned long eflags;
|
||||
unsigned long eax,ecx,edx,ebx;
|
||||
unsigned long esp;
|
||||
unsigned long ebp;
|
||||
unsigned long esi;
|
||||
unsigned long edi;
|
||||
unsigned long ip;
|
||||
unsigned long flags;
|
||||
unsigned long ax, cx, dx, bx;
|
||||
unsigned long sp, bp, si, di;
|
||||
unsigned short es, __esh;
|
||||
unsigned short cs, __csh;
|
||||
unsigned short ss, __ssh;
|
||||
@@ -346,10 +343,10 @@ struct tss_struct {
|
||||
struct thread_struct {
|
||||
/* cached TLS descriptors. */
|
||||
struct desc_struct tls_array[GDT_ENTRY_TLS_ENTRIES];
|
||||
unsigned long esp0;
|
||||
unsigned long sp0;
|
||||
unsigned long sysenter_cs;
|
||||
unsigned long eip;
|
||||
unsigned long esp;
|
||||
unsigned long ip;
|
||||
unsigned long sp;
|
||||
unsigned long fs;
|
||||
unsigned long gs;
|
||||
/* Hardware debugging registers */
|
||||
@@ -366,7 +363,7 @@ struct thread_struct {
|
||||
/* virtual 86 mode info */
|
||||
struct vm86_struct __user * vm86_info;
|
||||
unsigned long screen_bitmap;
|
||||
unsigned long v86flags, v86mask, saved_esp0;
|
||||
unsigned long v86flags, v86mask, saved_sp0;
|
||||
unsigned int saved_fs, saved_gs;
|
||||
/* IO permissions */
|
||||
unsigned long *io_bitmap_ptr;
|
||||
@@ -378,7 +375,7 @@ struct thread_struct {
|
||||
};
|
||||
|
||||
#define INIT_THREAD { \
|
||||
.esp0 = sizeof(init_stack) + (long)&init_stack, \
|
||||
.sp0 = sizeof(init_stack) + (long)&init_stack, \
|
||||
.vm86_info = NULL, \
|
||||
.sysenter_cs = __KERNEL_CS, \
|
||||
.io_bitmap_ptr = NULL, \
|
||||
@@ -393,7 +390,7 @@ struct thread_struct {
|
||||
*/
|
||||
#define INIT_TSS { \
|
||||
.x86_tss = { \
|
||||
.esp0 = sizeof(init_stack) + (long)&init_stack, \
|
||||
.sp0 = sizeof(init_stack) + (long)&init_stack, \
|
||||
.ss0 = __KERNEL_DS, \
|
||||
.ss1 = __KERNEL_CS, \
|
||||
.io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \
|
||||
@@ -503,9 +500,9 @@ static inline void rep_nop(void)
|
||||
|
||||
#define cpu_relax() rep_nop()
|
||||
|
||||
static inline void native_load_esp0(struct tss_struct *tss, struct thread_struct *thread)
|
||||
static inline void native_load_sp0(struct tss_struct *tss, struct thread_struct *thread)
|
||||
{
|
||||
tss->x86_tss.esp0 = thread->esp0;
|
||||
tss->x86_tss.sp0 = thread->sp0;
|
||||
/* This can only happen when SEP is enabled, no need to test "SEP"arately */
|
||||
if (unlikely(tss->x86_tss.ss1 != thread->sysenter_cs)) {
|
||||
tss->x86_tss.ss1 = thread->sysenter_cs;
|
||||
@@ -585,9 +582,9 @@ static inline void native_set_iopl_mask(unsigned mask)
|
||||
#define paravirt_enabled() 0
|
||||
#define __cpuid native_cpuid
|
||||
|
||||
static inline void load_esp0(struct tss_struct *tss, struct thread_struct *thread)
|
||||
static inline void load_sp0(struct tss_struct *tss, struct thread_struct *thread)
|
||||
{
|
||||
native_load_esp0(tss, thread);
|
||||
native_load_sp0(tss, thread);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -177,9 +177,9 @@ union i387_union {
|
||||
|
||||
struct tss_struct {
|
||||
u32 reserved1;
|
||||
u64 rsp0;
|
||||
u64 rsp1;
|
||||
u64 rsp2;
|
||||
u64 sp0;
|
||||
u64 sp1;
|
||||
u64 sp2;
|
||||
u64 reserved2;
|
||||
u64 ist[7];
|
||||
u32 reserved3;
|
||||
@@ -216,9 +216,9 @@ DECLARE_PER_CPU(struct orig_ist, orig_ist);
|
||||
#endif
|
||||
|
||||
struct thread_struct {
|
||||
unsigned long rsp0;
|
||||
unsigned long rsp;
|
||||
unsigned long userrsp; /* Copy from PDA */
|
||||
unsigned long sp0;
|
||||
unsigned long sp;
|
||||
unsigned long usersp; /* Copy from PDA */
|
||||
unsigned long fs;
|
||||
unsigned long gs;
|
||||
unsigned short es, ds, fsindex, gsindex;
|
||||
@@ -245,11 +245,11 @@ struct thread_struct {
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
#define INIT_THREAD { \
|
||||
.rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \
|
||||
.sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
|
||||
}
|
||||
|
||||
#define INIT_TSS { \
|
||||
.rsp0 = (unsigned long)&init_stack + sizeof(init_stack) \
|
||||
.sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
|
||||
}
|
||||
|
||||
#define INIT_MMAP \
|
||||
@@ -293,10 +293,10 @@ extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
|
||||
* Return saved PC of a blocked thread.
|
||||
* What is this good for? it will be always the scheduler or ret_from_fork.
|
||||
*/
|
||||
#define thread_saved_pc(t) (*(unsigned long *)((t)->thread.rsp - 8))
|
||||
#define thread_saved_pc(t) (*(unsigned long *)((t)->thread.sp - 8))
|
||||
|
||||
extern unsigned long get_wchan(struct task_struct *p);
|
||||
#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.rsp0 - 1)
|
||||
#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.sp0 - 1)
|
||||
#define KSTK_EIP(tsk) (task_pt_regs(tsk)->ip)
|
||||
#define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struc
|
||||
"1:\t" \
|
||||
"popl %%ebp\n\t" \
|
||||
"popfl" \
|
||||
:"=m" (prev->thread.esp),"=m" (prev->thread.eip), \
|
||||
:"=m" (prev->thread.sp),"=m" (prev->thread.ip), \
|
||||
"=a" (last),"=S" (esi),"=D" (edi) \
|
||||
:"m" (next->thread.esp),"m" (next->thread.eip), \
|
||||
:"m" (next->thread.sp),"m" (next->thread.ip), \
|
||||
"2" (prev), "d" (next)); \
|
||||
} while (0)
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
RESTORE_CONTEXT \
|
||||
: "=a" (last) \
|
||||
: [next] "S" (next), [prev] "D" (prev), \
|
||||
[threadrsp] "i" (offsetof(struct task_struct, thread.rsp)), \
|
||||
[threadrsp] "i" (offsetof(struct task_struct, thread.sp)), \
|
||||
[ti_flags] "i" (offsetof(struct thread_info, flags)),\
|
||||
[tif_fork] "i" (TIF_FORK), \
|
||||
[thread_info] "i" (offsetof(struct task_struct, stack)), \
|
||||
|
||||
Reference in New Issue
Block a user