2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2018 The FreeBSD Foundation
7 * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
8 * under sponsorship from the FreeBSD Foundation.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 #include <machine/asmacros.h>
35 #include <machine/cputypes.h>
36 #include <machine/pmap.h>
37 #include <machine/specialreg.h>
50 movl $copyout_fault,%edx
51 movl 20(%ebp),%ebx /* KCR3 */
53 movl PCPU(CURPCB),%eax
54 movl PCB_CR3(%eax),%edi
57 movl PCPU(TRAMPSTK),%esi
58 movl PCPU(COPYOUT_BUF),%eax
61 movl 12(%ebp),%eax /* udaddr */
64 movl 16(%ebp),%eax /* len */
71 movl 8(%ebp),%eax /* kaddr */
74 movl PCPU(COPYOUT_BUF),%eax
77 movl 16(%ebp),%eax /* len */
84 /* bcopy(%esi = kaddr, %edi = PCPU(copyout_buf), %ecx = len) */
93 /* bcopy(%esi = PCPU(copyout_buf), %edi = udaddr, %ecx = len) */
118 movl $copyout_fault,%edx
119 movl 20(%ebp),%ebx /* KCR3 */
121 movl PCPU(CURPCB),%eax
122 movl PCB_CR3(%eax),%edi
125 movl PCPU(TRAMPSTK),%esi
126 movl PCPU(COPYOUT_BUF),%eax
129 movl 12(%ebp),%eax /* kaddr */
132 movl 16(%ebp),%eax /* len */
136 movl 8(%ebp),%eax /* udaddr */
139 movl PCPU(COPYOUT_BUF),%eax
142 movl 16(%ebp),%eax /* len */
150 /* bcopy(%esi = udaddr, %edi = PCPU(copyout_buf), %ecx = len) */
158 /* bcopy(%esi = PCPU(copyout_buf), %edi = kaddr, %ecx = len) */
192 movl 8(%ebp),%ecx /* from */
193 movl PCPU(CURPCB),%eax
194 movl PCB_CR3(%eax),%eax
199 movl PCPU(TRAMPSTK),%esp
221 movl 8(%ebp),%ecx /* from */
222 movl PCPU(CURPCB),%eax
223 movl PCB_CR3(%eax),%eax
228 movl PCPU(TRAMPSTK),%esp
247 movl 8(%ebp),%ecx /* from */
248 movl PCPU(CURPCB),%eax
249 movl PCB_CR3(%eax),%eax
254 movl PCPU(TRAMPSTK),%esp
285 movl PCPU(CURPCB),%eax
286 movl PCB_CR3(%eax),%eax
288 movl 8(%ebp),%ecx /* to */
289 movl 12(%ebp),%edi /* val */
293 movl PCPU(TRAMPSTK),%esp
313 movl PCPU(CURPCB),%eax
314 movl PCB_CR3(%eax),%eax
316 movl 8(%ebp),%ecx /* to */
317 movl 12(%ebp),%edi /* val */
321 movl PCPU(TRAMPSTK),%esp
341 movl PCPU(CURPCB),%eax
342 movl PCB_CR3(%eax),%eax
344 movl 8(%ebp),%ecx /* to */
345 movl 12(%ebp),%edi /* val */
349 movl PCPU(TRAMPSTK),%esp