use copyin()/copyout() instead of fubyte()/subyte()
also nuke uvm_useracc() check, copyin()/copyout() do this atomically XXX only compile-tested
This commit is contained in:
parent
dd1c661661
commit
e0fe42681d
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: linux_machdep.c,v 1.17 2003/01/18 08:02:49 thorpej Exp $ */
|
/* $NetBSD: linux_machdep.c,v 1.18 2003/08/02 19:51:23 jdolecek Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
|
* Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.17 2003/01/18 08:02:49 thorpej Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.18 2003/08/02 19:51:23 jdolecek Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
|
@ -442,21 +442,20 @@ linux_sys_sysmips(l, v, retval)
|
||||||
case LINUX_MIPS_ATOMIC_SET: {
|
case LINUX_MIPS_ATOMIC_SET: {
|
||||||
void *addr;
|
void *addr;
|
||||||
int s;
|
int s;
|
||||||
|
u_int8_t value = 0;
|
||||||
|
|
||||||
addr = (void *)SCARG(uap, arg1);
|
addr = (void *)SCARG(uap, arg1);
|
||||||
|
|
||||||
if ((uvm_useracc((caddr_t)addr, sizeof(int),
|
|
||||||
B_READ | B_WRITE)) != 1)
|
|
||||||
return EFAULT;
|
|
||||||
|
|
||||||
s = splhigh();
|
s = splhigh();
|
||||||
/*
|
/*
|
||||||
* No error testing here. This is bad, but Linux does
|
* No error testing here. This is bad, but Linux does
|
||||||
* it like this. The source aknowledge "This is broken"
|
* it like this. The source aknowledge "This is broken"
|
||||||
* in a comment...
|
* in a comment...
|
||||||
*/
|
*/
|
||||||
*retval = (register_t)fubyte(addr);
|
(void) copyin(addr, &value, 1);
|
||||||
error = subyte(addr, SCARG(uap, arg2));
|
*retval = value;
|
||||||
|
value = (u_int8_t) SCARG(uap, arg2);
|
||||||
|
error = copyout(&value, addr, 1);
|
||||||
splx(s);
|
splx(s);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue