Commit 56177d2a authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: i387 math-emu annotation

arch/i386/math-emu/* annotated.
parent 0fd81bef
...@@ -41,18 +41,18 @@ void Un_impl(void) ...@@ -41,18 +41,18 @@ void Un_impl(void)
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
/* No need to verify_area(), we have previously fetched these bytes. */ /* No need to verify_area(), we have previously fetched these bytes. */
printk("Unimplemented FPU Opcode at eip=%p : ", (void *) address); printk("Unimplemented FPU Opcode at eip=%p : ", (void __user *) address);
if ( FPU_CS == __USER_CS ) if ( FPU_CS == __USER_CS )
{ {
while ( 1 ) while ( 1 )
{ {
FPU_get_user(byte1, (u_char *) address); FPU_get_user(byte1, (u_char __user *) address);
if ( (byte1 & 0xf8) == 0xd8 ) break; if ( (byte1 & 0xf8) == 0xd8 ) break;
printk("[%02x]", byte1); printk("[%02x]", byte1);
address++; address++;
} }
printk("%02x ", byte1); printk("%02x ", byte1);
FPU_get_user(FPU_modrm, 1 + (u_char *) address); FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
if (FPU_modrm >= 0300) if (FPU_modrm >= 0300)
printk("%02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8, FPU_modrm & 7); printk("%02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8, FPU_modrm & 7);
...@@ -98,7 +98,7 @@ void FPU_printall(void) ...@@ -98,7 +98,7 @@ void FPU_printall(void)
#define MAX_PRINTED_BYTES 20 #define MAX_PRINTED_BYTES 20
for ( i = 0; i < MAX_PRINTED_BYTES; i++ ) for ( i = 0; i < MAX_PRINTED_BYTES; i++ )
{ {
FPU_get_user(byte1, (u_char *) address); FPU_get_user(byte1, (u_char __user *) address);
if ( (byte1 & 0xf8) == 0xd8 ) if ( (byte1 & 0xf8) == 0xd8 )
{ {
printk(" %02x", byte1); printk(" %02x", byte1);
...@@ -111,7 +111,7 @@ void FPU_printall(void) ...@@ -111,7 +111,7 @@ void FPU_printall(void)
printk(" [more..]\n"); printk(" [more..]\n");
else else
{ {
FPU_get_user(FPU_modrm, 1 + (u_char *) address); FPU_get_user(FPU_modrm, 1 + (u_char __user *) address);
if (FPU_modrm >= 0300) if (FPU_modrm >= 0300)
printk(" %02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8, FPU_modrm & 7); printk(" %02x (%02x+%d)\n", FPU_modrm, FPU_modrm & 0xf8, FPU_modrm & 7);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "status_w.h" #include "status_w.h"
void fadd__() void fadd__(void)
{ {
/* fadd st,st(i) */ /* fadd st,st(i) */
int i = FPU_rm; int i = FPU_rm;
...@@ -25,7 +25,7 @@ void fadd__() ...@@ -25,7 +25,7 @@ void fadd__()
} }
void fmul__() void fmul__(void)
{ {
/* fmul st,st(i) */ /* fmul st,st(i) */
int i = FPU_rm; int i = FPU_rm;
...@@ -35,7 +35,7 @@ void fmul__() ...@@ -35,7 +35,7 @@ void fmul__()
void fsub__() void fsub__(void)
{ {
/* fsub st,st(i) */ /* fsub st,st(i) */
clear_C1(); clear_C1();
...@@ -43,7 +43,7 @@ void fsub__() ...@@ -43,7 +43,7 @@ void fsub__()
} }
void fsubr_() void fsubr_(void)
{ {
/* fsubr st,st(i) */ /* fsubr st,st(i) */
clear_C1(); clear_C1();
...@@ -51,7 +51,7 @@ void fsubr_() ...@@ -51,7 +51,7 @@ void fsubr_()
} }
void fdiv__() void fdiv__(void)
{ {
/* fdiv st,st(i) */ /* fdiv st,st(i) */
clear_C1(); clear_C1();
...@@ -59,7 +59,7 @@ void fdiv__() ...@@ -59,7 +59,7 @@ void fdiv__()
} }
void fdivr_() void fdivr_(void)
{ {
/* fdivr st,st(i) */ /* fdivr st,st(i) */
clear_C1(); clear_C1();
...@@ -68,7 +68,7 @@ void fdivr_() ...@@ -68,7 +68,7 @@ void fdivr_()
void fadd_i() void fadd_i(void)
{ {
/* fadd st(i),st */ /* fadd st(i),st */
int i = FPU_rm; int i = FPU_rm;
...@@ -77,7 +77,7 @@ void fadd_i() ...@@ -77,7 +77,7 @@ void fadd_i()
} }
void fmul_i() void fmul_i(void)
{ {
/* fmul st(i),st */ /* fmul st(i),st */
clear_C1(); clear_C1();
...@@ -85,7 +85,7 @@ void fmul_i() ...@@ -85,7 +85,7 @@ void fmul_i()
} }
void fsubri() void fsubri(void)
{ {
/* fsubr st(i),st */ /* fsubr st(i),st */
clear_C1(); clear_C1();
...@@ -93,7 +93,7 @@ void fsubri() ...@@ -93,7 +93,7 @@ void fsubri()
} }
void fsub_i() void fsub_i(void)
{ {
/* fsub st(i),st */ /* fsub st(i),st */
clear_C1(); clear_C1();
...@@ -101,7 +101,7 @@ void fsub_i() ...@@ -101,7 +101,7 @@ void fsub_i()
} }
void fdivri() void fdivri(void)
{ {
/* fdivr st(i),st */ /* fdivr st(i),st */
clear_C1(); clear_C1();
...@@ -109,7 +109,7 @@ void fdivri() ...@@ -109,7 +109,7 @@ void fdivri()
} }
void fdiv_i() void fdiv_i(void)
{ {
/* fdiv st(i),st */ /* fdiv st(i),st */
clear_C1(); clear_C1();
...@@ -118,7 +118,7 @@ void fdiv_i() ...@@ -118,7 +118,7 @@ void fdiv_i()
void faddp_() void faddp_(void)
{ {
/* faddp st(i),st */ /* faddp st(i),st */
int i = FPU_rm; int i = FPU_rm;
...@@ -128,7 +128,7 @@ void faddp_() ...@@ -128,7 +128,7 @@ void faddp_()
} }
void fmulp_() void fmulp_(void)
{ {
/* fmulp st(i),st */ /* fmulp st(i),st */
clear_C1(); clear_C1();
...@@ -138,7 +138,7 @@ void fmulp_() ...@@ -138,7 +138,7 @@ void fmulp_()
void fsubrp() void fsubrp(void)
{ {
/* fsubrp st(i),st */ /* fsubrp st(i),st */
clear_C1(); clear_C1();
...@@ -147,7 +147,7 @@ void fsubrp() ...@@ -147,7 +147,7 @@ void fsubrp()
} }
void fsubp_() void fsubp_(void)
{ {
/* fsubp st(i),st */ /* fsubp st(i),st */
clear_C1(); clear_C1();
...@@ -156,7 +156,7 @@ void fsubp_() ...@@ -156,7 +156,7 @@ void fsubp_()
} }
void fdivrp() void fdivrp(void)
{ {
/* fdivrp st(i),st */ /* fdivrp st(i),st */
clear_C1(); clear_C1();
...@@ -165,7 +165,7 @@ void fdivrp() ...@@ -165,7 +165,7 @@ void fdivrp()
} }
void fdivp_() void fdivp_(void)
{ {
/* fdivp st(i),st */ /* fdivp st(i),st */
clear_C1(); clear_C1();
......
...@@ -30,7 +30,7 @@ void fclex(void) ...@@ -30,7 +30,7 @@ void fclex(void)
} }
/* Needs to be externally visible */ /* Needs to be externally visible */
void finit() void finit(void)
{ {
control_word = 0x037f; control_word = 0x037f;
partial_status = 0; partial_status = 0;
...@@ -58,7 +58,7 @@ static FUNC const finit_table[] = { ...@@ -58,7 +58,7 @@ static FUNC const finit_table[] = {
fsetpm, FPU_illegal, FPU_illegal, FPU_illegal fsetpm, FPU_illegal, FPU_illegal, FPU_illegal
}; };
void finit_() void finit_(void)
{ {
(finit_table[FPU_rm])(); (finit_table[FPU_rm])();
} }
...@@ -75,7 +75,7 @@ static FUNC const fstsw_table[] = { ...@@ -75,7 +75,7 @@ static FUNC const fstsw_table[] = {
FPU_illegal, FPU_illegal, FPU_illegal, FPU_illegal FPU_illegal, FPU_illegal, FPU_illegal, FPU_illegal
}; };
void fstsw_() void fstsw_(void)
{ {
(fstsw_table[FPU_rm])(); (fstsw_table[FPU_rm])();
} }
...@@ -86,13 +86,13 @@ static FUNC const fp_nop_table[] = { ...@@ -86,13 +86,13 @@ static FUNC const fp_nop_table[] = {
FPU_illegal, FPU_illegal, FPU_illegal, FPU_illegal FPU_illegal, FPU_illegal, FPU_illegal, FPU_illegal
}; };
void fp_nop() void fp_nop(void)
{ {
(fp_nop_table[FPU_rm])(); (fp_nop_table[FPU_rm])();
} }
void fld_i_() void fld_i_(void)
{ {
FPU_REG *st_new_ptr; FPU_REG *st_new_ptr;
int i; int i;
...@@ -124,7 +124,7 @@ void fld_i_() ...@@ -124,7 +124,7 @@ void fld_i_()
} }
void fxch_i() void fxch_i(void)
{ {
/* fxch st(i) */ /* fxch st(i) */
FPU_REG t; FPU_REG t;
...@@ -173,14 +173,14 @@ void fxch_i() ...@@ -173,14 +173,14 @@ void fxch_i()
} }
void ffree_() void ffree_(void)
{ {
/* ffree st(i) */ /* ffree st(i) */
FPU_settagi(FPU_rm, TAG_Empty); FPU_settagi(FPU_rm, TAG_Empty);
} }
void ffreep() void ffreep(void)
{ {
/* ffree st(i) + pop - unofficial code */ /* ffree st(i) + pop - unofficial code */
FPU_settagi(FPU_rm, TAG_Empty); FPU_settagi(FPU_rm, TAG_Empty);
...@@ -188,14 +188,14 @@ void ffreep() ...@@ -188,14 +188,14 @@ void ffreep()
} }
void fst_i_() void fst_i_(void)
{ {
/* fst st(i) */ /* fst st(i) */
FPU_copy_to_regi(&st(0), FPU_gettag0(), FPU_rm); FPU_copy_to_regi(&st(0), FPU_gettag0(), FPU_rm);
} }
void fstp_i() void fstp_i(void)
{ {
/* fstp st(i) */ /* fstp st(i) */
FPU_copy_to_regi(&st(0), FPU_gettag0(), FPU_rm); FPU_copy_to_regi(&st(0), FPU_gettag0(), FPU_rm);
......
...@@ -128,7 +128,7 @@ static u_char const type_table[64] = { ...@@ -128,7 +128,7 @@ static u_char const type_table[64] = {
u_char emulating=0; u_char emulating=0;
#endif /* RE_ENTRANT_CHECKING */ #endif /* RE_ENTRANT_CHECKING */
static int valid_prefix(u_char *Byte, u_char **fpu_eip, static int valid_prefix(u_char *Byte, u_char __user **fpu_eip,
overrides *override); overrides *override);
asmlinkage void math_emulate(long arg) asmlinkage void math_emulate(long arg)
...@@ -140,7 +140,7 @@ asmlinkage void math_emulate(long arg) ...@@ -140,7 +140,7 @@ asmlinkage void math_emulate(long arg)
FPU_REG loaded_data; FPU_REG loaded_data;
FPU_REG *st0_ptr; FPU_REG *st0_ptr;
u_char loaded_tag, st0_tag; u_char loaded_tag, st0_tag;
void *data_address; void __user *data_address;
struct address data_sel_off; struct address data_sel_off;
struct address entry_sel_off; struct address entry_sel_off;
unsigned long code_base = 0; unsigned long code_base = 0;
...@@ -192,7 +192,8 @@ asmlinkage void math_emulate(long arg) ...@@ -192,7 +192,8 @@ asmlinkage void math_emulate(long arg)
math_abort(FPU_info, SIGILL); math_abort(FPU_info, SIGILL);
} }
if ( SEG_D_SIZE(code_descriptor = LDT_DESCRIPTOR(FPU_CS)) ) code_descriptor = LDT_DESCRIPTOR(FPU_CS);
if ( SEG_D_SIZE(code_descriptor) )
{ {
/* The above test may be wrong, the book is not clear */ /* The above test may be wrong, the book is not clear */
/* Segmented 32 bit protected mode */ /* Segmented 32 bit protected mode */
...@@ -214,7 +215,7 @@ asmlinkage void math_emulate(long arg) ...@@ -214,7 +215,7 @@ asmlinkage void math_emulate(long arg)
if (current->ptrace & PT_PTRACED) if (current->ptrace & PT_PTRACED)
FPU_lookahead = 0; FPU_lookahead = 0;
if ( !valid_prefix(&byte1, (u_char **)&FPU_EIP, if ( !valid_prefix(&byte1, (u_char __user **)&FPU_EIP,
&addr_modes.override) ) &addr_modes.override) )
{ {
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
...@@ -257,7 +258,7 @@ asmlinkage void math_emulate(long arg) ...@@ -257,7 +258,7 @@ asmlinkage void math_emulate(long arg)
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
FPU_code_verify_area(1); FPU_code_verify_area(1);
FPU_get_user(FPU_modrm, (u_char *) FPU_EIP); FPU_get_user(FPU_modrm, (u_char __user *) FPU_EIP);
RE_ENTRANT_CHECK_ON; RE_ENTRANT_CHECK_ON;
FPU_EIP++; FPU_EIP++;
...@@ -336,23 +337,23 @@ asmlinkage void math_emulate(long arg) ...@@ -336,23 +337,23 @@ asmlinkage void math_emulate(long arg)
switch ( (byte1 >> 1) & 3 ) switch ( (byte1 >> 1) & 3 )
{ {
case 0: case 0:
unmasked = FPU_load_single((float *)data_address, unmasked = FPU_load_single((float __user *)data_address,
&loaded_data); &loaded_data);
loaded_tag = unmasked & 0xff; loaded_tag = unmasked & 0xff;
unmasked &= ~0xff; unmasked &= ~0xff;
break; break;
case 1: case 1:
loaded_tag = FPU_load_int32((long *)data_address, &loaded_data); loaded_tag = FPU_load_int32((long __user *)data_address, &loaded_data);
break; break;
case 2: case 2:
unmasked = FPU_load_double((double *)data_address, unmasked = FPU_load_double((double __user *)data_address,
&loaded_data); &loaded_data);
loaded_tag = unmasked & 0xff; loaded_tag = unmasked & 0xff;
unmasked &= ~0xff; unmasked &= ~0xff;
break; break;
case 3: case 3:
default: /* Used here to suppress gcc warnings. */ default: /* Used here to suppress gcc warnings. */
loaded_tag = FPU_load_int16((short *)data_address, &loaded_data); loaded_tag = FPU_load_int16((short __user *)data_address, &loaded_data);
break; break;
} }
...@@ -563,7 +564,7 @@ asmlinkage void math_emulate(long arg) ...@@ -563,7 +564,7 @@ asmlinkage void math_emulate(long arg)
if (FPU_lookahead && !need_resched()) if (FPU_lookahead && !need_resched())
{ {
FPU_ORIG_EIP = FPU_EIP - code_base; FPU_ORIG_EIP = FPU_EIP - code_base;
if ( valid_prefix(&byte1, (u_char **)&FPU_EIP, if ( valid_prefix(&byte1, (u_char __user **)&FPU_EIP,
&addr_modes.override) ) &addr_modes.override) )
goto do_another_FPU_instruction; goto do_another_FPU_instruction;
} }
...@@ -579,11 +580,11 @@ asmlinkage void math_emulate(long arg) ...@@ -579,11 +580,11 @@ asmlinkage void math_emulate(long arg)
all prefix bytes, further changes are needed in the emulator code all prefix bytes, further changes are needed in the emulator code
which accesses user address space. Access to separate segments is which accesses user address space. Access to separate segments is
important for msdos emulation. */ important for msdos emulation. */
static int valid_prefix(u_char *Byte, u_char **fpu_eip, static int valid_prefix(u_char *Byte, u_char __user **fpu_eip,
overrides *override) overrides *override)
{ {
u_char byte; u_char byte;
u_char *ip = *fpu_eip; u_char __user *ip = *fpu_eip;
*override = (overrides) { 0, 0, PREFIX_DEFAULT }; /* defaults */ *override = (overrides) { 0, 0, PREFIX_DEFAULT }; /* defaults */
...@@ -679,9 +680,9 @@ void math_abort(struct info * info, unsigned int signal) ...@@ -679,9 +680,9 @@ void math_abort(struct info * info, unsigned int signal)
#define sstatus_word() \ #define sstatus_word() \
((S387->swd & ~SW_Top & 0xffff) | ((S387->ftop << SW_Top_Shift) & SW_Top)) ((S387->swd & ~SW_Top & 0xffff) | ((S387->ftop << SW_Top_Shift) & SW_Top))
int restore_i387_soft(void *s387, struct _fpstate *buf) int restore_i387_soft(void *s387, struct _fpstate __user *buf)
{ {
u_char *d = (u_char *)buf; u_char __user *d = (u_char __user *)buf;
int offset, other, i, tags, regnr, tag, newtop; int offset, other, i, tags, regnr, tag, newtop;
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
...@@ -725,9 +726,9 @@ int restore_i387_soft(void *s387, struct _fpstate *buf) ...@@ -725,9 +726,9 @@ int restore_i387_soft(void *s387, struct _fpstate *buf)
} }
int save_i387_soft(void *s387, struct _fpstate * buf) int save_i387_soft(void *s387, struct _fpstate __user * buf)
{ {
u_char *d = (u_char *)buf; u_char __user *d = (u_char __user *)buf;
int offset = (S387->ftop & 7) * 10, other = 80 - offset; int offset = (S387->ftop & 7) * 10, other = 80 - offset;
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
......
...@@ -137,7 +137,7 @@ static FUNC_ST0 const fp_etc_table[] = { ...@@ -137,7 +137,7 @@ static FUNC_ST0 const fp_etc_table[] = {
ftst_, fxam, (FUNC_ST0)FPU_illegal, (FUNC_ST0)FPU_illegal ftst_, fxam, (FUNC_ST0)FPU_illegal, (FUNC_ST0)FPU_illegal
}; };
void FPU_etc() void FPU_etc(void)
{ {
(fp_etc_table[FPU_rm])(&st(0), FPU_gettag0()); (fp_etc_table[FPU_rm])(&st(0), FPU_gettag0());
} }
...@@ -77,13 +77,13 @@ extern void FPU_copy_to_reg0(FPU_REG const *r, u_char tag); ...@@ -77,13 +77,13 @@ extern void FPU_copy_to_reg0(FPU_REG const *r, u_char tag);
extern void FPU_triga(void); extern void FPU_triga(void);
extern void FPU_trigb(void); extern void FPU_trigb(void);
/* get_address.c */ /* get_address.c */
extern void *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip, extern void __user *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip,
struct address *addr, fpu_addr_modes addr_modes); struct address *addr, fpu_addr_modes addr_modes);
extern void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, extern void __user *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip,
struct address *addr, fpu_addr_modes addr_modes); struct address *addr, fpu_addr_modes addr_modes);
/* load_store.c */ /* load_store.c */
extern int FPU_load_store(u_char type, fpu_addr_modes addr_modes, extern int FPU_load_store(u_char type, fpu_addr_modes addr_modes,
void *data_address); void __user *data_address);
/* poly_2xm1.c */ /* poly_2xm1.c */
extern int poly_2xm1(u_char sign, FPU_REG *arg, FPU_REG *result); extern int poly_2xm1(u_char sign, FPU_REG *arg, FPU_REG *result);
/* poly_atan.c */ /* poly_atan.c */
...@@ -112,26 +112,26 @@ extern void fucompp(void); ...@@ -112,26 +112,26 @@ extern void fucompp(void);
/* reg_constant.c */ /* reg_constant.c */
extern void fconst(void); extern void fconst(void);
/* reg_ld_str.c */ /* reg_ld_str.c */
extern int FPU_load_extended(long double *s, int stnr); extern int FPU_load_extended(long double __user *s, int stnr);
extern int FPU_load_double(double *dfloat, FPU_REG *loaded_data); extern int FPU_load_double(double __user *dfloat, FPU_REG *loaded_data);
extern int FPU_load_single(float *single, FPU_REG *loaded_data); extern int FPU_load_single(float __user *single, FPU_REG *loaded_data);
extern int FPU_load_int64(long long *_s); extern int FPU_load_int64(long long __user *_s);
extern int FPU_load_int32(long *_s, FPU_REG *loaded_data); extern int FPU_load_int32(long __user *_s, FPU_REG *loaded_data);
extern int FPU_load_int16(short *_s, FPU_REG *loaded_data); extern int FPU_load_int16(short __user *_s, FPU_REG *loaded_data);
extern int FPU_load_bcd(u_char *s); extern int FPU_load_bcd(u_char __user *s);
extern int FPU_store_extended(FPU_REG *st0_ptr, u_char st0_tag, extern int FPU_store_extended(FPU_REG *st0_ptr, u_char st0_tag,
long double *d); long double __user *d);
extern int FPU_store_double(FPU_REG *st0_ptr, u_char st0_tag, double *dfloat); extern int FPU_store_double(FPU_REG *st0_ptr, u_char st0_tag, double __user *dfloat);
extern int FPU_store_single(FPU_REG *st0_ptr, u_char st0_tag, float *single); extern int FPU_store_single(FPU_REG *st0_ptr, u_char st0_tag, float __user *single);
extern int FPU_store_int64(FPU_REG *st0_ptr, u_char st0_tag, long long *d); extern int FPU_store_int64(FPU_REG *st0_ptr, u_char st0_tag, long long __user *d);
extern int FPU_store_int32(FPU_REG *st0_ptr, u_char st0_tag, long *d); extern int FPU_store_int32(FPU_REG *st0_ptr, u_char st0_tag, long __user *d);
extern int FPU_store_int16(FPU_REG *st0_ptr, u_char st0_tag, short *d); extern int FPU_store_int16(FPU_REG *st0_ptr, u_char st0_tag, short __user *d);
extern int FPU_store_bcd(FPU_REG *st0_ptr, u_char st0_tag, u_char *d); extern int FPU_store_bcd(FPU_REG *st0_ptr, u_char st0_tag, u_char __user *d);
extern int FPU_round_to_int(FPU_REG *r, u_char tag); extern int FPU_round_to_int(FPU_REG *r, u_char tag);
extern u_char *fldenv(fpu_addr_modes addr_modes, u_char *s); extern u_char __user *fldenv(fpu_addr_modes addr_modes, u_char __user *s);
extern void frstor(fpu_addr_modes addr_modes, u_char *data_address); extern void frstor(fpu_addr_modes addr_modes, u_char __user *data_address);
extern u_char *fstenv(fpu_addr_modes addr_modes, u_char *d); extern u_char __user *fstenv(fpu_addr_modes addr_modes, u_char __user *d);
extern void fsave(fpu_addr_modes addr_modes, u_char *data_address); extern void fsave(fpu_addr_modes addr_modes, u_char __user *data_address);
extern int FPU_tagof(FPU_REG *ptr); extern int FPU_tagof(FPU_REG *ptr);
/* reg_mul.c */ /* reg_mul.c */
extern int FPU_mul(FPU_REG const *b, u_char tagb, int deststnr, int control_w); extern int FPU_mul(FPU_REG const *b, u_char tagb, int deststnr, int control_w);
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
/* A simpler test than verify_area() can probably be done for /* A simpler test than verify_area() can probably be done for
FPU_code_verify_area() because the only possible error is to step FPU_code_verify_area() because the only possible error is to step
past the upper boundary of a legal code area. */ past the upper boundary of a legal code area. */
#define FPU_code_verify_area(z) FPU_verify_area(VERIFY_READ,(void *)FPU_EIP,z) #define FPU_code_verify_area(z) FPU_verify_area(VERIFY_READ,(void __user *)FPU_EIP,z)
#endif #endif
#define FPU_get_user(x,y) get_user((x),(y)) #define FPU_get_user(x,y) get_user((x),(y))
......
...@@ -82,7 +82,7 @@ static int sib(int mod, unsigned long *fpu_eip) ...@@ -82,7 +82,7 @@ static int sib(int mod, unsigned long *fpu_eip)
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
FPU_code_verify_area(1); FPU_code_verify_area(1);
FPU_get_user(base, (u_char *) (*fpu_eip)); /* The SIB byte */ FPU_get_user(base, (u_char __user *) (*fpu_eip)); /* The SIB byte */
RE_ENTRANT_CHECK_ON; RE_ENTRANT_CHECK_ON;
(*fpu_eip)++; (*fpu_eip)++;
ss = base >> 6; ss = base >> 6;
...@@ -112,7 +112,7 @@ static int sib(int mod, unsigned long *fpu_eip) ...@@ -112,7 +112,7 @@ static int sib(int mod, unsigned long *fpu_eip)
long displacement; long displacement;
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
FPU_code_verify_area(1); FPU_code_verify_area(1);
FPU_get_user(displacement, (signed char *) (*fpu_eip)); FPU_get_user(displacement, (signed char __user *) (*fpu_eip));
offset += displacement; offset += displacement;
RE_ENTRANT_CHECK_ON; RE_ENTRANT_CHECK_ON;
(*fpu_eip)++; (*fpu_eip)++;
...@@ -123,7 +123,7 @@ static int sib(int mod, unsigned long *fpu_eip) ...@@ -123,7 +123,7 @@ static int sib(int mod, unsigned long *fpu_eip)
long displacement; long displacement;
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
FPU_code_verify_area(4); FPU_code_verify_area(4);
FPU_get_user(displacement, (long *) (*fpu_eip)); FPU_get_user(displacement, (long __user *) (*fpu_eip));
offset += displacement; offset += displacement;
RE_ENTRANT_CHECK_ON; RE_ENTRANT_CHECK_ON;
(*fpu_eip) += 4; (*fpu_eip) += 4;
...@@ -241,7 +241,7 @@ static long pm_address(u_char FPU_modrm, u_char segment, ...@@ -241,7 +241,7 @@ static long pm_address(u_char FPU_modrm, u_char segment,
*/ */
void *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip, void __user *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip,
struct address *addr, struct address *addr,
fpu_addr_modes addr_modes) fpu_addr_modes addr_modes)
{ {
...@@ -277,24 +277,24 @@ void *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip, ...@@ -277,24 +277,24 @@ void *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip,
/* Special case: disp32 */ /* Special case: disp32 */
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
FPU_code_verify_area(4); FPU_code_verify_area(4);
FPU_get_user(address, (unsigned long *) (*fpu_eip)); FPU_get_user(address, (unsigned long __user *) (*fpu_eip));
(*fpu_eip) += 4; (*fpu_eip) += 4;
RE_ENTRANT_CHECK_ON; RE_ENTRANT_CHECK_ON;
addr->offset = address; addr->offset = address;
return (void *) address; return (void __user *) address;
} }
else else
{ {
address = *cpu_reg_ptr; /* Just return the contents address = *cpu_reg_ptr; /* Just return the contents
of the cpu register */ of the cpu register */
addr->offset = address; addr->offset = address;
return (void *) address; return (void __user *) address;
} }
case 1: case 1:
/* 8 bit signed displacement */ /* 8 bit signed displacement */
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
FPU_code_verify_area(1); FPU_code_verify_area(1);
FPU_get_user(address, (signed char *) (*fpu_eip)); FPU_get_user(address, (signed char __user *) (*fpu_eip));
RE_ENTRANT_CHECK_ON; RE_ENTRANT_CHECK_ON;
(*fpu_eip)++; (*fpu_eip)++;
break; break;
...@@ -302,7 +302,7 @@ void *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip, ...@@ -302,7 +302,7 @@ void *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip,
/* 32 bit displacement */ /* 32 bit displacement */
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
FPU_code_verify_area(4); FPU_code_verify_area(4);
FPU_get_user(address, (long *) (*fpu_eip)); FPU_get_user(address, (long __user *) (*fpu_eip));
(*fpu_eip) += 4; (*fpu_eip) += 4;
RE_ENTRANT_CHECK_ON; RE_ENTRANT_CHECK_ON;
break; break;
...@@ -331,11 +331,11 @@ void *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip, ...@@ -331,11 +331,11 @@ void *FPU_get_address(u_char FPU_modrm, unsigned long *fpu_eip,
EXCEPTION(EX_INTERNAL|0x133); EXCEPTION(EX_INTERNAL|0x133);
} }
return (void *)address; return (void __user *)address;
} }
void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, void __user *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip,
struct address *addr, struct address *addr,
fpu_addr_modes addr_modes) fpu_addr_modes addr_modes)
{ {
...@@ -363,7 +363,7 @@ void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, ...@@ -363,7 +363,7 @@ void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip,
/* Special case: disp16 */ /* Special case: disp16 */
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
FPU_code_verify_area(2); FPU_code_verify_area(2);
FPU_get_user(address, (unsigned short *) (*fpu_eip)); FPU_get_user(address, (unsigned short __user *) (*fpu_eip));
(*fpu_eip) += 2; (*fpu_eip) += 2;
RE_ENTRANT_CHECK_ON; RE_ENTRANT_CHECK_ON;
goto add_segment; goto add_segment;
...@@ -373,7 +373,7 @@ void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, ...@@ -373,7 +373,7 @@ void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip,
/* 8 bit signed displacement */ /* 8 bit signed displacement */
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
FPU_code_verify_area(1); FPU_code_verify_area(1);
FPU_get_user(address, (signed char *) (*fpu_eip)); FPU_get_user(address, (signed char __user *) (*fpu_eip));
RE_ENTRANT_CHECK_ON; RE_ENTRANT_CHECK_ON;
(*fpu_eip)++; (*fpu_eip)++;
break; break;
...@@ -381,7 +381,7 @@ void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, ...@@ -381,7 +381,7 @@ void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip,
/* 16 bit displacement */ /* 16 bit displacement */
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
FPU_code_verify_area(2); FPU_code_verify_area(2);
FPU_get_user(address, (unsigned short *) (*fpu_eip)); FPU_get_user(address, (unsigned short __user *) (*fpu_eip));
(*fpu_eip) += 2; (*fpu_eip) += 2;
RE_ENTRANT_CHECK_ON; RE_ENTRANT_CHECK_ON;
break; break;
...@@ -445,5 +445,5 @@ void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip, ...@@ -445,5 +445,5 @@ void *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip,
EXCEPTION(EX_INTERNAL|0x131); EXCEPTION(EX_INTERNAL|0x131);
} }
return (void *)address ; return (void __user *)address ;
} }
...@@ -61,7 +61,7 @@ u_char const data_sizes_32[32] = { ...@@ -61,7 +61,7 @@ u_char const data_sizes_32[32] = {
}; };
int FPU_load_store(u_char type, fpu_addr_modes addr_modes, int FPU_load_store(u_char type, fpu_addr_modes addr_modes,
void *data_address) void __user *data_address)
{ {
FPU_REG loaded_data; FPU_REG loaded_data;
FPU_REG *st0_ptr; FPU_REG *st0_ptr;
...@@ -119,7 +119,7 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes, ...@@ -119,7 +119,7 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes,
{ {
case 000: /* fld m32real */ case 000: /* fld m32real */
clear_C1(); clear_C1();
loaded_tag = FPU_load_single((float *)data_address, &loaded_data); loaded_tag = FPU_load_single((float __user *)data_address, &loaded_data);
if ( (loaded_tag == TAG_Special) if ( (loaded_tag == TAG_Special)
&& isNaN(&loaded_data) && isNaN(&loaded_data)
&& (real_1op_NaN(&loaded_data) < 0) ) && (real_1op_NaN(&loaded_data) < 0) )
...@@ -131,12 +131,12 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes, ...@@ -131,12 +131,12 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes,
break; break;
case 001: /* fild m32int */ case 001: /* fild m32int */
clear_C1(); clear_C1();
loaded_tag = FPU_load_int32((long *)data_address, &loaded_data); loaded_tag = FPU_load_int32((long __user *)data_address, &loaded_data);
FPU_copy_to_reg0(&loaded_data, loaded_tag); FPU_copy_to_reg0(&loaded_data, loaded_tag);
break; break;
case 002: /* fld m64real */ case 002: /* fld m64real */
clear_C1(); clear_C1();
loaded_tag = FPU_load_double((double *)data_address, &loaded_data); loaded_tag = FPU_load_double((double __user *)data_address, &loaded_data);
if ( (loaded_tag == TAG_Special) if ( (loaded_tag == TAG_Special)
&& isNaN(&loaded_data) && isNaN(&loaded_data)
&& (real_1op_NaN(&loaded_data) < 0) ) && (real_1op_NaN(&loaded_data) < 0) )
...@@ -148,68 +148,68 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes, ...@@ -148,68 +148,68 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes,
break; break;
case 003: /* fild m16int */ case 003: /* fild m16int */
clear_C1(); clear_C1();
loaded_tag = FPU_load_int16((short *)data_address, &loaded_data); loaded_tag = FPU_load_int16((short __user *)data_address, &loaded_data);
FPU_copy_to_reg0(&loaded_data, loaded_tag); FPU_copy_to_reg0(&loaded_data, loaded_tag);
break; break;
case 010: /* fst m32real */ case 010: /* fst m32real */
clear_C1(); clear_C1();
FPU_store_single(st0_ptr, st0_tag, (float *)data_address); FPU_store_single(st0_ptr, st0_tag, (float __user *)data_address);
break; break;
case 011: /* fist m32int */ case 011: /* fist m32int */
clear_C1(); clear_C1();
FPU_store_int32(st0_ptr, st0_tag, (long *)data_address); FPU_store_int32(st0_ptr, st0_tag, (long __user *)data_address);
break; break;
case 012: /* fst m64real */ case 012: /* fst m64real */
clear_C1(); clear_C1();
FPU_store_double(st0_ptr, st0_tag, (double *)data_address); FPU_store_double(st0_ptr, st0_tag, (double __user *)data_address);
break; break;
case 013: /* fist m16int */ case 013: /* fist m16int */
clear_C1(); clear_C1();
FPU_store_int16(st0_ptr, st0_tag, (short *)data_address); FPU_store_int16(st0_ptr, st0_tag, (short __user *)data_address);
break; break;
case 014: /* fstp m32real */ case 014: /* fstp m32real */
clear_C1(); clear_C1();
if ( FPU_store_single(st0_ptr, st0_tag, (float *)data_address) ) if ( FPU_store_single(st0_ptr, st0_tag, (float __user *)data_address) )
pop_0(); /* pop only if the number was actually stored pop_0(); /* pop only if the number was actually stored
(see the 80486 manual p16-28) */ (see the 80486 manual p16-28) */
break; break;
case 015: /* fistp m32int */ case 015: /* fistp m32int */
clear_C1(); clear_C1();
if ( FPU_store_int32(st0_ptr, st0_tag, (long *)data_address) ) if ( FPU_store_int32(st0_ptr, st0_tag, (long __user *)data_address) )
pop_0(); /* pop only if the number was actually stored pop_0(); /* pop only if the number was actually stored
(see the 80486 manual p16-28) */ (see the 80486 manual p16-28) */
break; break;
case 016: /* fstp m64real */ case 016: /* fstp m64real */
clear_C1(); clear_C1();
if ( FPU_store_double(st0_ptr, st0_tag, (double *)data_address) ) if ( FPU_store_double(st0_ptr, st0_tag, (double __user *)data_address) )
pop_0(); /* pop only if the number was actually stored pop_0(); /* pop only if the number was actually stored
(see the 80486 manual p16-28) */ (see the 80486 manual p16-28) */
break; break;
case 017: /* fistp m16int */ case 017: /* fistp m16int */
clear_C1(); clear_C1();
if ( FPU_store_int16(st0_ptr, st0_tag, (short *)data_address) ) if ( FPU_store_int16(st0_ptr, st0_tag, (short __user *)data_address) )
pop_0(); /* pop only if the number was actually stored pop_0(); /* pop only if the number was actually stored
(see the 80486 manual p16-28) */ (see the 80486 manual p16-28) */
break; break;
case 020: /* fldenv m14/28byte */ case 020: /* fldenv m14/28byte */
fldenv(addr_modes, (u_char *)data_address); fldenv(addr_modes, (u_char __user *)data_address);
/* Ensure that the values just loaded are not changed by /* Ensure that the values just loaded are not changed by
fix-up operations. */ fix-up operations. */
return 1; return 1;
case 022: /* frstor m94/108byte */ case 022: /* frstor m94/108byte */
frstor(addr_modes, (u_char *)data_address); frstor(addr_modes, (u_char __user *)data_address);
/* Ensure that the values just loaded are not changed by /* Ensure that the values just loaded are not changed by
fix-up operations. */ fix-up operations. */
return 1; return 1;
case 023: /* fbld m80dec */ case 023: /* fbld m80dec */
clear_C1(); clear_C1();
loaded_tag = FPU_load_bcd((u_char *)data_address); loaded_tag = FPU_load_bcd((u_char __user *)data_address);
FPU_settag0(loaded_tag); FPU_settag0(loaded_tag);
break; break;
case 024: /* fldcw */ case 024: /* fldcw */
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
FPU_verify_area(VERIFY_READ, data_address, 2); FPU_verify_area(VERIFY_READ, data_address, 2);
FPU_get_user(control_word, (unsigned short *) data_address); FPU_get_user(control_word, (unsigned short __user *) data_address);
RE_ENTRANT_CHECK_ON; RE_ENTRANT_CHECK_ON;
if ( partial_status & ~control_word & CW_Exceptions ) if ( partial_status & ~control_word & CW_Exceptions )
partial_status |= (SW_Summary | SW_Backward); partial_status |= (SW_Summary | SW_Backward);
...@@ -221,47 +221,47 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes, ...@@ -221,47 +221,47 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes,
return 1; return 1;
case 025: /* fld m80real */ case 025: /* fld m80real */
clear_C1(); clear_C1();
loaded_tag = FPU_load_extended((long double *)data_address, 0); loaded_tag = FPU_load_extended((long double __user *)data_address, 0);
FPU_settag0(loaded_tag); FPU_settag0(loaded_tag);
break; break;
case 027: /* fild m64int */ case 027: /* fild m64int */
clear_C1(); clear_C1();
loaded_tag = FPU_load_int64((long long *)data_address); loaded_tag = FPU_load_int64((long long __user *)data_address);
FPU_settag0(loaded_tag); FPU_settag0(loaded_tag);
break; break;
case 030: /* fstenv m14/28byte */ case 030: /* fstenv m14/28byte */
fstenv(addr_modes, (u_char *)data_address); fstenv(addr_modes, (u_char __user *)data_address);
return 1; return 1;
case 032: /* fsave */ case 032: /* fsave */
fsave(addr_modes, (u_char *)data_address); fsave(addr_modes, (u_char __user *)data_address);
return 1; return 1;
case 033: /* fbstp m80dec */ case 033: /* fbstp m80dec */
clear_C1(); clear_C1();
if ( FPU_store_bcd(st0_ptr, st0_tag, (u_char *)data_address) ) if ( FPU_store_bcd(st0_ptr, st0_tag, (u_char __user *)data_address) )
pop_0(); /* pop only if the number was actually stored pop_0(); /* pop only if the number was actually stored
(see the 80486 manual p16-28) */ (see the 80486 manual p16-28) */
break; break;
case 034: /* fstcw m16int */ case 034: /* fstcw m16int */
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
FPU_verify_area(VERIFY_WRITE,data_address,2); FPU_verify_area(VERIFY_WRITE,data_address,2);
FPU_put_user(control_word, (unsigned short *) data_address); FPU_put_user(control_word, (unsigned short __user *) data_address);
RE_ENTRANT_CHECK_ON; RE_ENTRANT_CHECK_ON;
return 1; return 1;
case 035: /* fstp m80real */ case 035: /* fstp m80real */
clear_C1(); clear_C1();
if ( FPU_store_extended(st0_ptr, st0_tag, (long double *)data_address) ) if ( FPU_store_extended(st0_ptr, st0_tag, (long double __user *)data_address) )
pop_0(); /* pop only if the number was actually stored pop_0(); /* pop only if the number was actually stored
(see the 80486 manual p16-28) */ (see the 80486 manual p16-28) */
break; break;
case 036: /* fstsw m2byte */ case 036: /* fstsw m2byte */
RE_ENTRANT_CHECK_OFF; RE_ENTRANT_CHECK_OFF;
FPU_verify_area(VERIFY_WRITE,data_address,2); FPU_verify_area(VERIFY_WRITE,data_address,2);
FPU_put_user(status_word(),(unsigned short *) data_address); FPU_put_user(status_word(),(unsigned short __user *) data_address);
RE_ENTRANT_CHECK_ON; RE_ENTRANT_CHECK_ON;
return 1; return 1;
case 037: /* fistp m64int */ case 037: /* fistp m64int */
clear_C1(); clear_C1();
if ( FPU_store_int64(st0_ptr, st0_tag, (long long *)data_address) ) if ( FPU_store_int64(st0_ptr, st0_tag, (long long __user *)data_address) )
pop_0(); /* pop only if the number was actually stored pop_0(); /* pop only if the number was actually stored
(see the 80486 manual p16-28) */ (see the 80486 manual p16-28) */
break; break;
......
...@@ -324,14 +324,14 @@ static int compare_u_st_st(int nr) ...@@ -324,14 +324,14 @@ static int compare_u_st_st(int nr)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void fcom_st() void fcom_st(void)
{ {
/* fcom st(i) */ /* fcom st(i) */
compare_st_st(FPU_rm); compare_st_st(FPU_rm);
} }
void fcompst() void fcompst(void)
{ {
/* fcomp st(i) */ /* fcomp st(i) */
if ( !compare_st_st(FPU_rm) ) if ( !compare_st_st(FPU_rm) )
...@@ -339,7 +339,7 @@ void fcompst() ...@@ -339,7 +339,7 @@ void fcompst()
} }
void fcompp() void fcompp(void)
{ {
/* fcompp */ /* fcompp */
if (FPU_rm != 1) if (FPU_rm != 1)
...@@ -352,7 +352,7 @@ void fcompp() ...@@ -352,7 +352,7 @@ void fcompp()
} }
void fucom_() void fucom_(void)
{ {
/* fucom st(i) */ /* fucom st(i) */
compare_u_st_st(FPU_rm); compare_u_st_st(FPU_rm);
...@@ -360,7 +360,7 @@ void fucom_() ...@@ -360,7 +360,7 @@ void fucom_()
} }
void fucomp() void fucomp(void)
{ {
/* fucomp st(i) */ /* fucomp st(i) */
if ( !compare_u_st_st(FPU_rm) ) if ( !compare_u_st_st(FPU_rm) )
...@@ -368,7 +368,7 @@ void fucomp() ...@@ -368,7 +368,7 @@ void fucomp()
} }
void fucompp() void fucompp(void)
{ {
/* fucompp */ /* fucompp */
if (FPU_rm == 1) if (FPU_rm == 1)
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment