diff options
Diffstat (limited to 'arch/x86/math-emu/get_address.c')
-rw-r--r-- | arch/x86/math-emu/get_address.c | 69 |
1 files changed, 33 insertions, 36 deletions
diff --git a/arch/x86/math-emu/get_address.c b/arch/x86/math-emu/get_address.c index d701e2b39e44..420b3b6e3915 100644 --- a/arch/x86/math-emu/get_address.c +++ b/arch/x86/math-emu/get_address.c | |||
@@ -29,46 +29,43 @@ | |||
29 | #define FPU_WRITE_BIT 0x10 | 29 | #define FPU_WRITE_BIT 0x10 |
30 | 30 | ||
31 | static int reg_offset[] = { | 31 | static int reg_offset[] = { |
32 | offsetof(struct info, ___eax), | 32 | offsetof(struct pt_regs, ax), |
33 | offsetof(struct info, ___ecx), | 33 | offsetof(struct pt_regs, cx), |
34 | offsetof(struct info, ___edx), | 34 | offsetof(struct pt_regs, dx), |
35 | offsetof(struct info, ___ebx), | 35 | offsetof(struct pt_regs, bx), |
36 | offsetof(struct info, ___esp), | 36 | offsetof(struct pt_regs, sp), |
37 | offsetof(struct info, ___ebp), | 37 | offsetof(struct pt_regs, bp), |
38 | offsetof(struct info, ___esi), | 38 | offsetof(struct pt_regs, si), |
39 | offsetof(struct info, ___edi) | 39 | offsetof(struct pt_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->regs)) |
43 | 43 | ||
44 | static int reg_offset_vm86[] = { | 44 | static int reg_offset_vm86[] = { |
45 | offsetof(struct info, ___cs), | 45 | offsetof(struct pt_regs, cs), |
46 | offsetof(struct info, ___vm86_ds), | 46 | offsetof(struct kernel_vm86_regs, ds), |
47 | offsetof(struct info, ___vm86_es), | 47 | offsetof(struct kernel_vm86_regs, es), |
48 | offsetof(struct info, ___vm86_fs), | 48 | offsetof(struct kernel_vm86_regs, fs), |
49 | offsetof(struct info, ___vm86_gs), | 49 | offsetof(struct kernel_vm86_regs, gs), |
50 | offsetof(struct info, ___ss), | 50 | offsetof(struct pt_regs, ss), |
51 | offsetof(struct info, ___vm86_ds) | 51 | offsetof(struct kernel_vm86_regs, 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->regs)) |
56 | |||
57 | /* This dummy, gs is not saved on the stack. */ | ||
58 | #define ___GS ___ds | ||
59 | 56 | ||
60 | static int reg_offset_pm[] = { | 57 | static int reg_offset_pm[] = { |
61 | offsetof(struct info, ___cs), | 58 | offsetof(struct pt_regs, cs), |
62 | offsetof(struct info, ___ds), | 59 | offsetof(struct pt_regs, ds), |
63 | offsetof(struct info, ___es), | 60 | offsetof(struct pt_regs, es), |
64 | offsetof(struct info, ___fs), | 61 | offsetof(struct pt_regs, fs), |
65 | offsetof(struct info, ___GS), | 62 | offsetof(struct pt_regs, ds), /* dummy, not saved on stack */ |
66 | offsetof(struct info, ___ss), | 63 | offsetof(struct pt_regs, ss), |
67 | offsetof(struct info, ___ds) | 64 | offsetof(struct pt_regs, ds) |
68 | }; | 65 | }; |
69 | 66 | ||
70 | #define PM_REG_(x) (*(unsigned short *) \ | 67 | #define PM_REG_(x) (*(unsigned short *) \ |
71 | (reg_offset_pm[((unsigned)x)]+(u_char *) FPU_info)) | 68 | (reg_offset_pm[((unsigned)x)] + (u_char *)FPU_info->regs)) |
72 | 69 | ||
73 | /* Decode the SIB byte. This function assumes mod != 0 */ | 70 | /* Decode the SIB byte. This function assumes mod != 0 */ |
74 | static int sib(int mod, unsigned long *fpu_eip) | 71 | static int sib(int mod, unsigned long *fpu_eip) |
@@ -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 | ||