| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: copy.S,v 1.22 2010/07/07 01:21:15 chs Exp $ */ | | 1 | /* $NetBSD: copy.S,v 1.23 2014/01/10 16:47:07 pedro Exp $ */ |
2 | /* NetBSD: locore.S,v 1.34 2005/04/01 11:59:31 yamt Exp $ */ | | 2 | /* NetBSD: locore.S,v 1.34 2005/04/01 11:59:31 yamt Exp $ */ |
3 | | | 3 | |
4 | /*- | | 4 | /*- |
5 | * Copyright (c) 1998, 2000, 2004, 2008 The NetBSD Foundation, Inc. | | 5 | * Copyright (c) 1998, 2000, 2004, 2008 The NetBSD Foundation, Inc. |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * This code is derived from software contributed to The NetBSD Foundation | | 8 | * This code is derived from software contributed to The NetBSD Foundation |
9 | * by Charles M. Hannum. | | 9 | * by Charles M. Hannum. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -55,27 +55,27 @@ | | | @@ -55,27 +55,27 @@ |
55 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 55 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
56 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 56 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
57 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 57 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
58 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 58 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
59 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 59 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
60 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 60 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
61 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 61 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
62 | * SUCH DAMAGE. | | 62 | * SUCH DAMAGE. |
63 | * | | 63 | * |
64 | * @(#)locore.s 7.3 (Berkeley) 5/13/91 | | 64 | * @(#)locore.s 7.3 (Berkeley) 5/13/91 |
65 | */ | | 65 | */ |
66 | | | 66 | |
67 | #include <machine/asm.h> | | 67 | #include <machine/asm.h> |
68 | __KERNEL_RCSID(0, "$NetBSD: copy.S,v 1.22 2010/07/07 01:21:15 chs Exp $"); | | 68 | __KERNEL_RCSID(0, "$NetBSD: copy.S,v 1.23 2014/01/10 16:47:07 pedro Exp $"); |
69 | | | 69 | |
70 | #include "assym.h" | | 70 | #include "assym.h" |
71 | | | 71 | |
72 | #include <sys/errno.h> | | 72 | #include <sys/errno.h> |
73 | | | 73 | |
74 | #include <machine/frameasm.h> | | 74 | #include <machine/frameasm.h> |
75 | #include <machine/cputypes.h> | | 75 | #include <machine/cputypes.h> |
76 | | | 76 | |
77 | #define GET_CURPCB(reg) \ | | 77 | #define GET_CURPCB(reg) \ |
78 | movl CPUVAR(CURLWP), reg; \ | | 78 | movl CPUVAR(CURLWP), reg; \ |
79 | movl L_PCB(reg), reg | | 79 | movl L_PCB(reg), reg |
80 | | | 80 | |
81 | /* | | 81 | /* |
| @@ -260,29 +260,29 @@ ENTRY(copyout) | | | @@ -260,29 +260,29 @@ ENTRY(copyout) |
260 | * Copy len bytes from the user's address space. | | 260 | * Copy len bytes from the user's address space. |
261 | * see copyin(9) | | 261 | * see copyin(9) |
262 | */ | | 262 | */ |
263 | | | 263 | |
264 | /* LINTSTUB: Func: int copyin(const void *uaddr, void *kaddr, size_t len) */ | | 264 | /* LINTSTUB: Func: int copyin(const void *uaddr, void *kaddr, size_t len) */ |
265 | ENTRY(copyin) | | 265 | ENTRY(copyin) |
266 | DEFERRED_SWITCH_CHECK | | 266 | DEFERRED_SWITCH_CHECK |
267 | pushl %esi | | 267 | pushl %esi |
268 | pushl %edi | | 268 | pushl %edi |
269 | movl 12(%esp),%esi | | 269 | movl 12(%esp),%esi |
270 | movl 16(%esp),%edi | | 270 | movl 16(%esp),%edi |
271 | movl 20(%esp),%eax | | 271 | movl 20(%esp),%eax |
272 | /* | | 272 | /* |
273 | * We check that the end of the destination buffer is not past the end | | 273 | * We check that the end of the source buffer is not past the end of |
274 | * of the user's address space. If it's not, then we only need to | | 274 | * the user's address space. If it's not, then we only need to check |
275 | * check that each page is readable, and the CPU will do that for us. | | 275 | * that each page is readable, and the CPU will do that for us. |
276 | */ | | 276 | */ |
277 | .Lcopyin_start: | | 277 | .Lcopyin_start: |
278 | movl %esi,%edx | | 278 | movl %esi,%edx |
279 | addl %eax,%edx | | 279 | addl %eax,%edx |
280 | jc _C_LABEL(copy_efault) | | 280 | jc _C_LABEL(copy_efault) |
281 | cmpl $VM_MAXUSER_ADDRESS,%edx | | 281 | cmpl $VM_MAXUSER_ADDRESS,%edx |
282 | ja _C_LABEL(copy_efault) | | 282 | ja _C_LABEL(copy_efault) |
283 | movl %eax,%ecx | | 283 | movl %eax,%ecx |
284 | shrl $2,%ecx | | 284 | shrl $2,%ecx |
285 | rep | | 285 | rep |
286 | movsl | | 286 | movsl |
287 | andl $3,%eax | | 287 | andl $3,%eax |
288 | jz 1f | | 288 | jz 1f |