summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.transmeta.com>2003-04-08 08:45:40 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2003-04-08 08:45:40 -0700
commit34bf22f4ab76bc01be245d3151187f42ef483325 (patch)
tree3b622615dac254a54c4a641f18774780b4e02588
parent1eaa7f24217510d047a9bfafc7b26463cd24c502 (diff)
Annotate x87 user space access functions with proper type attributes.
-rw-r--r--arch/i386/kernel/i387.c70
-rw-r--r--include/asm-i386/math_emu.h4
2 files changed, 37 insertions, 37 deletions
diff --git a/arch/i386/kernel/i387.c b/arch/i386/kernel/i387.c
index d313fe8ced6e..a7db0c08b2ea 100644
--- a/arch/i386/kernel/i387.c
+++ b/arch/i386/kernel/i387.c
@@ -40,10 +40,10 @@ void init_fpu(struct task_struct *tsk)
tsk->thread.i387.fxsave.mxcsr = 0x1f80;
} else {
memset(&tsk->thread.i387.fsave, 0, sizeof(struct i387_fsave_struct));
- tsk->thread.i387.fsave.cwd = 0xffff037f;
- tsk->thread.i387.fsave.swd = 0xffff0000;
- tsk->thread.i387.fsave.twd = 0xffffffff;
- tsk->thread.i387.fsave.fos = 0xffff0000;
+ tsk->thread.i387.fsave.cwd = 0xffff037fu;
+ tsk->thread.i387.fsave.swd = 0xffff0000u;
+ tsk->thread.i387.fsave.twd = 0xffffffffu;
+ tsk->thread.i387.fsave.fos = 0xffff0000u;
}
tsk->used_math = 1;
}
@@ -98,7 +98,7 @@ static inline unsigned long twd_fxsr_to_i387( struct i387_fxsave_struct *fxsave
struct _fpxreg *st = NULL;
unsigned long twd = (unsigned long) fxsave->twd;
unsigned long tag;
- unsigned long ret = 0xffff0000;
+ unsigned long ret = 0xffff0000u;
int i;
#define FPREG_ADDR(f, n) ((char *)&(f)->st_space + (n) * 16);
@@ -183,7 +183,7 @@ void set_fpu_cwd( struct task_struct *tsk, unsigned short cwd )
if ( cpu_has_fxsr ) {
tsk->thread.i387.fxsave.cwd = cwd;
} else {
- tsk->thread.i387.fsave.cwd = ((long)cwd | 0xffff0000);
+ tsk->thread.i387.fsave.cwd = ((long)cwd | 0xffff0000u);
}
}
@@ -192,7 +192,7 @@ void set_fpu_swd( struct task_struct *tsk, unsigned short swd )
if ( cpu_has_fxsr ) {
tsk->thread.i387.fxsave.swd = swd;
} else {
- tsk->thread.i387.fsave.swd = ((long)swd | 0xffff0000);
+ tsk->thread.i387.fsave.swd = ((long)swd | 0xffff0000u);
}
}
@@ -201,7 +201,7 @@ void set_fpu_twd( struct task_struct *tsk, unsigned short twd )
if ( cpu_has_fxsr ) {
tsk->thread.i387.fxsave.twd = twd_i387_to_fxsr(twd);
} else {
- tsk->thread.i387.fsave.twd = ((long)twd | 0xffff0000);
+ tsk->thread.i387.fsave.twd = ((long)twd | 0xffff0000u);
}
}
@@ -216,16 +216,16 @@ void set_fpu_mxcsr( struct task_struct *tsk, unsigned short mxcsr )
* FXSR floating point environment conversions.
*/
-static int convert_fxsr_to_user( struct _fpstate *buf,
+static int convert_fxsr_to_user( struct _fpstate __user *buf,
struct i387_fxsave_struct *fxsave )
{
unsigned long env[7];
- struct _fpreg *to;
+ struct _fpreg __user *to;
struct _fpxreg *from;
int i;
- env[0] = (unsigned long)fxsave->cwd | 0xffff0000;
- env[1] = (unsigned long)fxsave->swd | 0xffff0000;
+ env[0] = (unsigned long)fxsave->cwd | 0xffff0000ul;
+ env[1] = (unsigned long)fxsave->swd | 0xffff0000ul;
env[2] = twd_fxsr_to_i387(fxsave);
env[3] = fxsave->fip;
env[4] = fxsave->fcs | ((unsigned long)fxsave->fop << 16);
@@ -250,11 +250,11 @@ static int convert_fxsr_to_user( struct _fpstate *buf,
}
static int convert_fxsr_from_user( struct i387_fxsave_struct *fxsave,
- struct _fpstate *buf )
+ struct _fpstate __user *buf )
{
unsigned long env[7];
struct _fpxreg *to;
- struct _fpreg *from;
+ struct _fpreg __user *from;
int i;
if ( __copy_from_user( env, buf, 7 * sizeof(long) ) )
@@ -264,7 +264,7 @@ static int convert_fxsr_from_user( struct i387_fxsave_struct *fxsave,
fxsave->swd = (unsigned short)(env[1] & 0xffff);
fxsave->twd = twd_i387_to_fxsr((unsigned short)(env[2] & 0xffff));
fxsave->fip = env[3];
- fxsave->fop = (unsigned short)((env[4] & 0xffff0000) >> 16);
+ fxsave->fop = (unsigned short)((env[4] & 0xffff0000ul) >> 16);
fxsave->fcs = (env[4] & 0xffff);
fxsave->foo = env[5];
fxsave->fos = env[6];
@@ -287,7 +287,7 @@ static int convert_fxsr_from_user( struct i387_fxsave_struct *fxsave,
* Signal frame handlers.
*/
-static inline int save_i387_fsave( struct _fpstate *buf )
+static inline int save_i387_fsave( struct _fpstate __user *buf )
{
struct task_struct *tsk = current;
@@ -299,7 +299,7 @@ static inline int save_i387_fsave( struct _fpstate *buf )
return 1;
}
-static int save_i387_fxsave( struct _fpstate *buf )
+static int save_i387_fxsave( struct _fpstate __user *buf )
{
struct task_struct *tsk = current;
int err = 0;
@@ -320,7 +320,7 @@ static int save_i387_fxsave( struct _fpstate *buf )
return 1;
}
-int save_i387( struct _fpstate *buf )
+int save_i387( struct _fpstate __user *buf )
{
if ( !current->used_math )
return 0;
@@ -341,7 +341,7 @@ int save_i387( struct _fpstate *buf )
}
}
-static inline int restore_i387_fsave( struct _fpstate *buf )
+static inline int restore_i387_fsave( struct _fpstate __user *buf )
{
struct task_struct *tsk = current;
clear_fpu( tsk );
@@ -349,7 +349,7 @@ static inline int restore_i387_fsave( struct _fpstate *buf )
sizeof(struct i387_fsave_struct) );
}
-static int restore_i387_fxsave( struct _fpstate *buf )
+static int restore_i387_fxsave( struct _fpstate __user *buf )
{
int err;
struct task_struct *tsk = current;
@@ -361,7 +361,7 @@ static int restore_i387_fxsave( struct _fpstate *buf )
return err ? 1 : convert_fxsr_from_user( &tsk->thread.i387.fxsave, buf );
}
-int restore_i387( struct _fpstate *buf )
+int restore_i387( struct _fpstate __user *buf )
{
int err;
@@ -382,21 +382,21 @@ int restore_i387( struct _fpstate *buf )
* ptrace request handlers.
*/
-static inline int get_fpregs_fsave( struct user_i387_struct *buf,
+static inline int get_fpregs_fsave( struct user_i387_struct __user *buf,
struct task_struct *tsk )
{
return __copy_to_user( buf, &tsk->thread.i387.fsave,
sizeof(struct user_i387_struct) );
}
-static inline int get_fpregs_fxsave( struct user_i387_struct *buf,
+static inline int get_fpregs_fxsave( struct user_i387_struct __user *buf,
struct task_struct *tsk )
{
- return convert_fxsr_to_user( (struct _fpstate *)buf,
+ return convert_fxsr_to_user( (struct _fpstate __user *)buf,
&tsk->thread.i387.fxsave );
}
-int get_fpregs( struct user_i387_struct *buf, struct task_struct *tsk )
+int get_fpregs( struct user_i387_struct __user *buf, struct task_struct *tsk )
{
if ( HAVE_HWFP ) {
if ( cpu_has_fxsr ) {
@@ -406,25 +406,25 @@ int get_fpregs( struct user_i387_struct *buf, struct task_struct *tsk )
}
} else {
return save_i387_soft( &tsk->thread.i387.soft,
- (struct _fpstate *)buf );
+ (struct _fpstate __user *)buf );
}
}
static inline int set_fpregs_fsave( struct task_struct *tsk,
- struct user_i387_struct *buf )
+ struct user_i387_struct __user *buf )
{
return __copy_from_user( &tsk->thread.i387.fsave, buf,
sizeof(struct user_i387_struct) );
}
static inline int set_fpregs_fxsave( struct task_struct *tsk,
- struct user_i387_struct *buf )
+ struct user_i387_struct __user *buf )
{
return convert_fxsr_from_user( &tsk->thread.i387.fxsave,
- (struct _fpstate *)buf );
+ (struct _fpstate __user *)buf );
}
-int set_fpregs( struct task_struct *tsk, struct user_i387_struct *buf )
+int set_fpregs( struct task_struct *tsk, struct user_i387_struct __user *buf )
{
if ( HAVE_HWFP ) {
if ( cpu_has_fxsr ) {
@@ -434,14 +434,14 @@ int set_fpregs( struct task_struct *tsk, struct user_i387_struct *buf )
}
} else {
return restore_i387_soft( &tsk->thread.i387.soft,
- (struct _fpstate *)buf );
+ (struct _fpstate __user *)buf );
}
}
-int get_fpxregs( struct user_fxsr_struct *buf, struct task_struct *tsk )
+int get_fpxregs( struct user_fxsr_struct __user *buf, struct task_struct *tsk )
{
if ( cpu_has_fxsr ) {
- if (__copy_to_user( (void *)buf, &tsk->thread.i387.fxsave,
+ if (__copy_to_user( buf, &tsk->thread.i387.fxsave,
sizeof(struct user_fxsr_struct) ))
return -EFAULT;
return 0;
@@ -450,10 +450,10 @@ int get_fpxregs( struct user_fxsr_struct *buf, struct task_struct *tsk )
}
}
-int set_fpxregs( struct task_struct *tsk, struct user_fxsr_struct *buf )
+int set_fpxregs( struct task_struct *tsk, struct user_fxsr_struct __user *buf )
{
if ( cpu_has_fxsr ) {
- __copy_from_user( &tsk->thread.i387.fxsave, (void *)buf,
+ __copy_from_user( &tsk->thread.i387.fxsave, buf,
sizeof(struct user_fxsr_struct) );
/* mxcsr bit 6 and 31-16 must be zero for security reasons */
tsk->thread.i387.fxsave.mxcsr &= 0xffbf;
diff --git a/include/asm-i386/math_emu.h b/include/asm-i386/math_emu.h
index bc8421d5e5ff..697673b555ce 100644
--- a/include/asm-i386/math_emu.h
+++ b/include/asm-i386/math_emu.h
@@ -3,8 +3,8 @@
#include <asm/sigcontext.h>
-int restore_i387_soft(void *s387, struct _fpstate *buf);
-int save_i387_soft(void *s387, struct _fpstate * buf);
+int restore_i387_soft(void *s387, struct _fpstate __user *buf);
+int save_i387_soft(void *s387, struct _fpstate __user *buf);
/* This structure matches the layout of the data saved to the stack
following a device-not-present interrupt, part of it saved