Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b095a04 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Ingo Molnar
Browse files

x86: cleanup i387_32.c according to checkpatch



clean up checkpatch warnings/errors on i387_32.c

The old and new i387_32.s (asm listings) were checked with diff to
be identical so it's safe to apply this patch.

Signed-off-by: default avatarCyrill Gorcunov <gorunov@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 3c233d13
Loading
Loading
Loading
Loading
+149 −142
Original line number Diff line number Diff line
@@ -29,10 +29,12 @@ void mxcsr_feature_mask_init(void)
	unsigned long mask = 0;
	clts();
	if (cpu_has_fxsr) {
		memset(&current->thread.i387.fxsave, 0, sizeof(struct i387_fxsave_struct));
		memset(&current->thread.i387.fxsave, 0,
		       sizeof(struct i387_fxsave_struct));
		asm volatile("fxsave %0" : : "m" (current->thread.i387.fxsave));
		mask = current->thread.i387.fxsave.mxcsr_mask;
		if (mask == 0) mask = 0x0000ffbf;
		if (mask == 0)
			mask = 0x0000ffbf;
	}
	mxcsr_feature_mask &= mask;
	stts();
@@ -47,18 +49,21 @@ void mxcsr_feature_mask_init(void)
void init_fpu(struct task_struct *tsk)
{
	if (cpu_has_fxsr) {
		memset(&tsk->thread.i387.fxsave, 0, sizeof(struct i387_fxsave_struct));
		memset(&tsk->thread.i387.fxsave, 0,
		       sizeof(struct i387_fxsave_struct));
		tsk->thread.i387.fxsave.cwd = 0x37f;
		if (cpu_has_xmm)
			tsk->thread.i387.fxsave.mxcsr = 0x1f80;
	} else {
		memset(&tsk->thread.i387.fsave, 0, sizeof(struct i387_fsave_struct));
		memset(&tsk->thread.i387.fsave, 0,
		       sizeof(struct i387_fsave_struct));
		tsk->thread.i387.fsave.cwd = 0xffff037fu;
		tsk->thread.i387.fsave.swd = 0xffff0000u;
		tsk->thread.i387.fsave.twd = 0xffffffffu;
		tsk->thread.i387.fsave.fos = 0xffff0000u;
	}
	/* only the device not available exception or ptrace can call init_fpu */
	/* only the device not available exception
	 * or ptrace can call init_fpu */
	set_stopped_child_used_math(tsk);
}

@@ -94,6 +99,7 @@ static inline unsigned short twd_i387_to_fxsr( unsigned short twd )
	tmp = (tmp | (tmp >> 1)) & 0x3333; /* 00VV00VV00VV00VV */
	tmp = (tmp | (tmp >> 2)) & 0x0f0f; /* 0000VVVV0000VVVV */
	tmp = (tmp | (tmp >> 4)) & 0x00ff; /* 00000000VVVVVVVV */

	return tmp;
}

@@ -462,7 +468,8 @@ int set_fpxregs( struct task_struct *tsk, struct user_fxsr_struct __user *buf )
		if (__copy_from_user(&tsk->thread.i387.fxsave, buf,
				     sizeof(struct user_fxsr_struct)))
			ret = -EFAULT;
		/* mxcsr reserved bits must be masked to zero for security reasons */
		/* mxcsr reserved bits must be masked to zero
		 * for security reasons */
		tsk->thread.i387.fxsave.mxcsr &= mxcsr_feature_mask;
	} else {
		ret = -EIO;
@@ -492,10 +499,9 @@ static inline void copy_fpu_fxsave( struct task_struct *tsk,

	to = (unsigned short *)&fpu->st_space[0];
	from = (unsigned short *)&tsk->thread.i387.fxsave.st_space[0];
	for ( i = 0 ; i < 8 ; i++, to += 5, from += 8 ) {
	for (i = 0; i < 8; i++, to += 5, from += 8)
		memcpy(to, from, 5 * sizeof(unsigned short));
}
}

int dump_fpu(struct pt_regs *regs, struct user_i387_struct *fpu)
{
@@ -531,7 +537,8 @@ int dump_task_fpu(struct task_struct *tsk, struct user_i387_struct *fpu)
	return fpvalid;
}

int dump_task_extended_fpu(struct task_struct *tsk, struct user_fxsr_struct *fpu)
int dump_task_extended_fpu(struct task_struct *tsk,
			   struct user_fxsr_struct *fpu)
{
	int fpvalid = tsk_used_math(tsk) && cpu_has_fxsr;