aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/math-emu
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-02-09 08:17:39 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-09 08:56:39 -0500
commitae6af41f5a4841f06eb92bc86ad020ad44ae2a30 (patch)
tree767d325dba40e954b277fd23db5842d6090ac540 /arch/x86/math-emu
parent914c3d630b29b07d04908eab1b246812dadd5bd6 (diff)
x86: math_emu info cleanup
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>
Diffstat (limited to 'arch/x86/math-emu')
-rw-r--r--arch/x86/math-emu/fpu_entry.c2
-rw-r--r--arch/x86/math-emu/fpu_proto.h2
-rw-r--r--arch/x86/math-emu/fpu_system.h14
-rw-r--r--arch/x86/math-emu/get_address.c63
4 files changed, 39 insertions, 42 deletions
diff --git a/arch/x86/math-emu/fpu_entry.c b/arch/x86/math-emu/fpu_entry.c
index c7b06feb139b..c268abe72253 100644
--- a/arch/x86/math-emu/fpu_entry.c
+++ b/arch/x86/math-emu/fpu_entry.c
@@ -659,7 +659,7 @@ static int valid_prefix(u_char *Byte, u_char __user **fpu_eip,
659 } 659 }
660} 660}
661 661
662void math_abort(struct info *info, unsigned int signal) 662void math_abort(struct math_emu_info *info, unsigned int signal)
663{ 663{
664 FPU_EIP = FPU_ORIG_EIP; 664 FPU_EIP = FPU_ORIG_EIP;
665 current->thread.trap_no = 16; 665 current->thread.trap_no = 16;
diff --git a/arch/x86/math-emu/fpu_proto.h b/arch/x86/math-emu/fpu_proto.h
index aa49b6a0d850..51bfbb61c5b1 100644
--- a/arch/x86/math-emu/fpu_proto.h
+++ b/arch/x86/math-emu/fpu_proto.h
@@ -52,7 +52,7 @@ extern void fst_i_(void);
52extern void fstp_i(void); 52extern void fstp_i(void);
53/* fpu_entry.c */ 53/* fpu_entry.c */
54asmlinkage extern void math_emulate(long arg); 54asmlinkage extern void math_emulate(long arg);
55extern void math_abort(struct info *info, unsigned int signal); 55extern void math_abort(struct math_emu_info *info, unsigned int signal);
56/* fpu_etc.c */ 56/* fpu_etc.c */
57extern void FPU_etc(void); 57extern void FPU_etc(void);
58/* fpu_tags.c */ 58/* fpu_tags.c */
diff --git a/arch/x86/math-emu/fpu_system.h b/arch/x86/math-emu/fpu_system.h
index 13488fa153e0..6729c6a31348 100644
--- a/arch/x86/math-emu/fpu_system.h
+++ b/arch/x86/math-emu/fpu_system.h
@@ -18,7 +18,7 @@
18 18
19/* This sets the pointer FPU_info to point to the argument part 19/* This sets the pointer FPU_info to point to the argument part
20 of the stack frame of math_emulate() */ 20 of the stack frame of math_emulate() */
21#define SETUP_DATA_AREA(arg) FPU_info = (struct info *) &arg 21#define SETUP_DATA_AREA(arg) FPU_info = (struct math_emu_info *) &arg
22 22
23/* s is always from a cpu register, and the cpu does bounds checking 23/* s is always from a cpu register, and the cpu does bounds checking
24 * during register load --> no further bounds checks needed */ 24 * during register load --> no further bounds checks needed */
@@ -38,12 +38,12 @@
38#define I387 (current->thread.xstate) 38#define I387 (current->thread.xstate)
39#define FPU_info (I387->soft.info) 39#define FPU_info (I387->soft.info)
40 40
41#define FPU_CS (*(unsigned short *) &(FPU_info->___cs)) 41#define FPU_CS (*(unsigned short *) &(FPU_info->regs.cs))
42#define FPU_SS (*(unsigned short *) &(FPU_info->___ss)) 42#define FPU_SS (*(unsigned short *) &(FPU_info->regs.ss))
43#define FPU_DS (*(unsigned short *) &(FPU_info->___ds)) 43#define FPU_DS (*(unsigned short *) &(FPU_info->regs.ds))
44#define FPU_EAX (FPU_info->___eax) 44#define FPU_EAX (FPU_info->regs.ax)
45#define FPU_EFLAGS (FPU_info->___eflags) 45#define FPU_EFLAGS (FPU_info->regs.flags)
46#define FPU_EIP (FPU_info->___eip) 46#define FPU_EIP (FPU_info->regs.ip)
47#define FPU_ORIG_EIP (FPU_info->___orig_eip) 47#define FPU_ORIG_EIP (FPU_info->___orig_eip)
48 48
49#define FPU_lookahead (I387->soft.lookahead) 49#define FPU_lookahead (I387->soft.lookahead)
diff --git a/arch/x86/math-emu/get_address.c b/arch/x86/math-emu/get_address.c
index d701e2b39e44..62daa7fcc44c 100644
--- a/arch/x86/math-emu/get_address.c
+++ b/arch/x86/math-emu/get_address.c
@@ -29,42 +29,39 @@
29#define FPU_WRITE_BIT 0x10 29#define FPU_WRITE_BIT 0x10
30 30
31static int reg_offset[] = { 31static int reg_offset[] = {
32 offsetof(struct info, ___eax), 32 offsetof(struct math_emu_info, regs.ax),
33 offsetof(struct info, ___ecx), 33 offsetof(struct math_emu_info, regs.cx),
34 offsetof(struct info, ___edx), 34 offsetof(struct math_emu_info, regs.dx),
35 offsetof(struct info, ___ebx), 35 offsetof(struct math_emu_info, regs.bx),
36 offsetof(struct info, ___esp), 36 offsetof(struct math_emu_info, regs.sp),
37 offsetof(struct info, ___ebp), 37 offsetof(struct math_emu_info, regs.bp),
38 offsetof(struct info, ___esi), 38 offsetof(struct math_emu_info, regs.si),
39 offsetof(struct info, ___edi) 39 offsetof(struct math_emu_info, regs.di)
40}; 40};
41 41
42#define REG_(x) (*(long *)(reg_offset[(x)]+(u_char *) FPU_info)) 42#define REG_(x) (*(long *)(reg_offset[(x)]+(u_char *) FPU_info))
43 43
44static int reg_offset_vm86[] = { 44static int reg_offset_vm86[] = {
45 offsetof(struct info, ___cs), 45 offsetof(struct math_emu_info, regs.cs),
46 offsetof(struct info, ___vm86_ds), 46 offsetof(struct math_emu_info, vm86.ds),
47 offsetof(struct info, ___vm86_es), 47 offsetof(struct math_emu_info, vm86.es),
48 offsetof(struct info, ___vm86_fs), 48 offsetof(struct math_emu_info, vm86.fs),
49 offsetof(struct info, ___vm86_gs), 49 offsetof(struct math_emu_info, vm86.gs),
50 offsetof(struct info, ___ss), 50 offsetof(struct math_emu_info, regs.ss),
51 offsetof(struct info, ___vm86_ds) 51 offsetof(struct math_emu_info, vm86.ds)
52}; 52};
53 53
54#define VM86_REG_(x) (*(unsigned short *) \ 54#define VM86_REG_(x) (*(unsigned short *) \
55 (reg_offset_vm86[((unsigned)x)]+(u_char *) FPU_info)) 55 (reg_offset_vm86[((unsigned)x)]+(u_char *) FPU_info))
56 56
57/* This dummy, gs is not saved on the stack. */
58#define ___GS ___ds
59
60static int reg_offset_pm[] = { 57static int reg_offset_pm[] = {
61 offsetof(struct info, ___cs), 58 offsetof(struct math_emu_info, regs.cs),
62 offsetof(struct info, ___ds), 59 offsetof(struct math_emu_info, regs.ds),
63 offsetof(struct info, ___es), 60 offsetof(struct math_emu_info, regs.es),
64 offsetof(struct info, ___fs), 61 offsetof(struct math_emu_info, regs.fs),
65 offsetof(struct info, ___GS), 62 offsetof(struct math_emu_info, regs.ds), /* dummy, not saved on stack */
66 offsetof(struct info, ___ss), 63 offsetof(struct math_emu_info, regs.ss),
67 offsetof(struct info, ___ds) 64 offsetof(struct math_emu_info, regs.ds)
68}; 65};
69 66
70#define PM_REG_(x) (*(unsigned short *) \ 67#define PM_REG_(x) (*(unsigned short *) \
@@ -349,34 +346,34 @@ void __user *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip,
349 } 346 }
350 switch (rm) { 347 switch (rm) {
351 case 0: 348 case 0:
352 address += FPU_info->___ebx + FPU_info->___esi; 349 address += FPU_info->regs.bx + FPU_info->regs.si;
353 break; 350 break;
354 case 1: 351 case 1:
355 address += FPU_info->___ebx + FPU_info->___edi; 352 address += FPU_info->regs.bx + FPU_info->regs.di;
356 break; 353 break;
357 case 2: 354 case 2:
358 address += FPU_info->___ebp + FPU_info->___esi; 355 address += FPU_info->regs.bp + FPU_info->regs.si;
359 if (addr_modes.override.segment == PREFIX_DEFAULT) 356 if (addr_modes.override.segment == PREFIX_DEFAULT)
360 addr_modes.override.segment = PREFIX_SS_; 357 addr_modes.override.segment = PREFIX_SS_;
361 break; 358 break;
362 case 3: 359 case 3:
363 address += FPU_info->___ebp + FPU_info->___edi; 360 address += FPU_info->regs.bp + FPU_info->regs.di;
364 if (addr_modes.override.segment == PREFIX_DEFAULT) 361 if (addr_modes.override.segment == PREFIX_DEFAULT)
365 addr_modes.override.segment = PREFIX_SS_; 362 addr_modes.override.segment = PREFIX_SS_;
366 break; 363 break;
367 case 4: 364 case 4:
368 address += FPU_info->___esi; 365 address += FPU_info->regs.si;
369 break; 366 break;
370 case 5: 367 case 5:
371 address += FPU_info->___edi; 368 address += FPU_info->regs.di;
372 break; 369 break;
373 case 6: 370 case 6:
374 address += FPU_info->___ebp; 371 address += FPU_info->regs.bp;
375 if (addr_modes.override.segment == PREFIX_DEFAULT) 372 if (addr_modes.override.segment == PREFIX_DEFAULT)
376 addr_modes.override.segment = PREFIX_SS_; 373 addr_modes.override.segment = PREFIX_SS_;
377 break; 374 break;
378 case 7: 375 case 7:
379 address += FPU_info->___ebx; 376 address += FPU_info->regs.bx;
380 break; 377 break;
381 } 378 }
382 379