]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
x86: math_emu info cleanup
authorTejun Heo <tj@kernel.org>
Mon, 9 Feb 2009 13:17:39 +0000 (22:17 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Mar 2009 00:32:44 +0000 (17:32 -0700)
commit ae6af41f5a4841f06eb92bc86ad020ad44ae2a30 upstream.

Impact: cleanup

* Come on, struct info?  s/struct info/struct math_emu_info/

* Use struct pt_regs and kernel_vm86_regs instead of defining its own
  register frame structure.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/include/asm/math_emu.h
arch/x86/include/asm/processor.h
arch/x86/math-emu/fpu_entry.c
arch/x86/math-emu/fpu_proto.h
arch/x86/math-emu/fpu_system.h
arch/x86/math-emu/get_address.c

index 5a65b107ad58350b4eb76bf6aaa4e639d2404b62..302492c77956ac86828208881947ffb8a54fd3c5 100644 (file)
@@ -1,31 +1,18 @@
 #ifndef _ASM_X86_MATH_EMU_H
 #define _ASM_X86_MATH_EMU_H
 
+#include <asm/ptrace.h>
+#include <asm/vm86.h>
+
 /* This structure matches the layout of the data saved to the stack
    following a device-not-present interrupt, part of it saved
    automatically by the 80386/80486.
    */
-struct info {
+struct math_emu_info {
        long ___orig_eip;
-       long ___ebx;
-       long ___ecx;
-       long ___edx;
-       long ___esi;
-       long ___edi;
-       long ___ebp;
-       long ___eax;
-       long ___ds;
-       long ___es;
-       long ___fs;
-       long ___orig_eax;
-       long ___eip;
-       long ___cs;
-       long ___eflags;
-       long ___esp;
-       long ___ss;
-       long ___vm86_es; /* This and the following only in vm86 mode */
-       long ___vm86_ds;
-       long ___vm86_fs;
-       long ___vm86_gs;
+       union {
+               struct pt_regs regs;
+               struct kernel_vm86_regs vm86;
+       };
 };
 #endif /* _ASM_X86_MATH_EMU_H */
index 5ca01e3832699b0378c36d79a4d17361a3d27b88..06d6f30fde6519de0d65a3509fe8eaf09a5c5f22 100644 (file)
@@ -349,7 +349,7 @@ struct i387_soft_struct {
        u8                      no_update;
        u8                      rm;
        u8                      alimit;
-       struct info             *info;
+       struct math_emu_info    *info;
        u32                     entry_eip;
 };
 
index c7b06feb139b9af7077a3c3ff8d15c4534a29368..c268abe722530c13735d9452b0678ea030401bf4 100644 (file)
@@ -659,7 +659,7 @@ static int valid_prefix(u_char *Byte, u_char __user **fpu_eip,
        }
 }
 
-void math_abort(struct info *info, unsigned int signal)
+void math_abort(struct math_emu_info *info, unsigned int signal)
 {
        FPU_EIP = FPU_ORIG_EIP;
        current->thread.trap_no = 16;
index aa49b6a0d850c616d1f257c563d8ad92ab255d95..51bfbb61c5b14baba520629d08fb43b5444d54d1 100644 (file)
@@ -52,7 +52,7 @@ extern void fst_i_(void);
 extern void fstp_i(void);
 /* fpu_entry.c */
 asmlinkage extern void math_emulate(long arg);
-extern void math_abort(struct info *info, unsigned int signal);
+extern void math_abort(struct math_emu_info *info, unsigned int signal);
 /* fpu_etc.c */
 extern void FPU_etc(void);
 /* fpu_tags.c */
index 13488fa153e0c81dacc9370edc1f0a2128d0babd..6729c6a31348bd05747ca4f8bda62fb8b3f52a6d 100644 (file)
@@ -18,7 +18,7 @@
 
 /* This sets the pointer FPU_info to point to the argument part
    of the stack frame of math_emulate() */
-#define SETUP_DATA_AREA(arg)   FPU_info = (struct info *) &arg
+#define SETUP_DATA_AREA(arg)   FPU_info = (struct math_emu_info *) &arg
 
 /* s is always from a cpu register, and the cpu does bounds checking
  * during register load --> no further bounds checks needed */
 #define I387                   (current->thread.xstate)
 #define FPU_info               (I387->soft.info)
 
-#define FPU_CS                 (*(unsigned short *) &(FPU_info->___cs))
-#define FPU_SS                 (*(unsigned short *) &(FPU_info->___ss))
-#define FPU_DS                 (*(unsigned short *) &(FPU_info->___ds))
-#define FPU_EAX                        (FPU_info->___eax)
-#define FPU_EFLAGS             (FPU_info->___eflags)
-#define FPU_EIP                        (FPU_info->___eip)
+#define FPU_CS                 (*(unsigned short *) &(FPU_info->regs.cs))
+#define FPU_SS                 (*(unsigned short *) &(FPU_info->regs.ss))
+#define FPU_DS                 (*(unsigned short *) &(FPU_info->regs.ds))
+#define FPU_EAX                        (FPU_info->regs.ax)
+#define FPU_EFLAGS             (FPU_info->regs.flags)
+#define FPU_EIP                        (FPU_info->regs.ip)
 #define FPU_ORIG_EIP           (FPU_info->___orig_eip)
 
 #define FPU_lookahead           (I387->soft.lookahead)
index d701e2b39e4438aacb8fc22ff000e79083f3bcec..62daa7fcc44c7a4212382cabac32ce62ea7b52dd 100644 (file)
 #define FPU_WRITE_BIT 0x10
 
 static int reg_offset[] = {
-       offsetof(struct info, ___eax),
-       offsetof(struct info, ___ecx),
-       offsetof(struct info, ___edx),
-       offsetof(struct info, ___ebx),
-       offsetof(struct info, ___esp),
-       offsetof(struct info, ___ebp),
-       offsetof(struct info, ___esi),
-       offsetof(struct info, ___edi)
+       offsetof(struct math_emu_info, regs.ax),
+       offsetof(struct math_emu_info, regs.cx),
+       offsetof(struct math_emu_info, regs.dx),
+       offsetof(struct math_emu_info, regs.bx),
+       offsetof(struct math_emu_info, regs.sp),
+       offsetof(struct math_emu_info, regs.bp),
+       offsetof(struct math_emu_info, regs.si),
+       offsetof(struct math_emu_info, regs.di)
 };
 
 #define REG_(x) (*(long *)(reg_offset[(x)]+(u_char *) FPU_info))
 
 static int reg_offset_vm86[] = {
-       offsetof(struct info, ___cs),
-       offsetof(struct info, ___vm86_ds),
-       offsetof(struct info, ___vm86_es),
-       offsetof(struct info, ___vm86_fs),
-       offsetof(struct info, ___vm86_gs),
-       offsetof(struct info, ___ss),
-       offsetof(struct info, ___vm86_ds)
+       offsetof(struct math_emu_info, regs.cs),
+       offsetof(struct math_emu_info, vm86.ds),
+       offsetof(struct math_emu_info, vm86.es),
+       offsetof(struct math_emu_info, vm86.fs),
+       offsetof(struct math_emu_info, vm86.gs),
+       offsetof(struct math_emu_info, regs.ss),
+       offsetof(struct math_emu_info, vm86.ds)
 };
 
 #define VM86_REG_(x) (*(unsigned short *) \
                      (reg_offset_vm86[((unsigned)x)]+(u_char *) FPU_info))
 
-/* This dummy, gs is not saved on the stack. */
-#define ___GS ___ds
-
 static int reg_offset_pm[] = {
-       offsetof(struct info, ___cs),
-       offsetof(struct info, ___ds),
-       offsetof(struct info, ___es),
-       offsetof(struct info, ___fs),
-       offsetof(struct info, ___GS),
-       offsetof(struct info, ___ss),
-       offsetof(struct info, ___ds)
+       offsetof(struct math_emu_info, regs.cs),
+       offsetof(struct math_emu_info, regs.ds),
+       offsetof(struct math_emu_info, regs.es),
+       offsetof(struct math_emu_info, regs.fs),
+       offsetof(struct math_emu_info, regs.ds), /* dummy, not saved on stack */
+       offsetof(struct math_emu_info, regs.ss),
+       offsetof(struct math_emu_info, regs.ds)
 };
 
 #define PM_REG_(x) (*(unsigned short *) \
@@ -349,34 +346,34 @@ void __user *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip,
        }
        switch (rm) {
        case 0:
-               address += FPU_info->___ebx + FPU_info->___esi;
+               address += FPU_info->regs.bx + FPU_info->regs.si;
                break;
        case 1:
-               address += FPU_info->___ebx + FPU_info->___edi;
+               address += FPU_info->regs.bx + FPU_info->regs.di;
                break;
        case 2:
-               address += FPU_info->___ebp + FPU_info->___esi;
+               address += FPU_info->regs.bp + FPU_info->regs.si;
                if (addr_modes.override.segment == PREFIX_DEFAULT)
                        addr_modes.override.segment = PREFIX_SS_;
                break;
        case 3:
-               address += FPU_info->___ebp + FPU_info->___edi;
+               address += FPU_info->regs.bp + FPU_info->regs.di;
                if (addr_modes.override.segment == PREFIX_DEFAULT)
                        addr_modes.override.segment = PREFIX_SS_;
                break;
        case 4:
-               address += FPU_info->___esi;
+               address += FPU_info->regs.si;
                break;
        case 5:
-               address += FPU_info->___edi;
+               address += FPU_info->regs.di;
                break;
        case 6:
-               address += FPU_info->___ebp;
+               address += FPU_info->regs.bp;
                if (addr_modes.override.segment == PREFIX_DEFAULT)
                        addr_modes.override.segment = PREFIX_SS_;
                break;
        case 7:
-               address += FPU_info->___ebx;
+               address += FPU_info->regs.bx;
                break;
        }