diff options
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 12 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 12 |
2 files changed, 22 insertions, 2 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index a65fc470ab8..b19edb0dcd2 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.228 2017/04/30 16:45:45 mpi Exp $ */ +/* $OpenBSD: machdep.c,v 1.229 2017/05/18 09:20:06 kettenis Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -1777,6 +1777,16 @@ splassert_check(int wantipl, const char *func) } #endif +int +copyin32(const uint32_t *uaddr, uint32_t *kaddr) +{ + if ((vaddr_t)uaddr & 0x3) + return EFAULT; + + /* copyin(9) is atomic */ + return copyin(uaddr, kaddr, sizeof(uint32_t)); +} + void getbootinfo(char *bootinfo, int bootinfo_size) { diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 315807b0405..6effaeaf1f1 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.600 2017/04/30 16:45:45 mpi Exp $ */ +/* $OpenBSD: machdep.c,v 1.601 2017/05/18 09:20:06 kettenis Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -3890,6 +3890,16 @@ splassert_check(int wantipl, const char *func) } #endif +int +copyin32(const uint32_t *uaddr, uint32_t *kaddr) +{ + if ((vaddr_t)uaddr & 0x3) + return EFAULT; + + /* copyin(9) is atomic */ + return copyin(uaddr, kaddr, sizeof(uint32_t)); +} + /* * True if the system has any non-level interrupts which are shared * on the same pin. |