2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2018 The FreeBSD Foundation
6 * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
7 * under sponsorship from the FreeBSD Foundation.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 #include <machine/asmacros.h>
34 #include <machine/cputypes.h>
35 #include <machine/pmap.h>
36 #include <machine/specialreg.h>
49 movl $copyout_fault,%edx
50 movl 20(%ebp),%ebx /* KCR3 */
52 movl PCPU(CURPCB),%eax
53 movl PCB_CR3(%eax),%edi
56 movl PCPU(TRAMPSTK),%esi
57 movl PCPU(COPYOUT_BUF),%eax
60 movl 12(%ebp),%eax /* udaddr */
63 movl 16(%ebp),%eax /* len */
70 movl 8(%ebp),%eax /* kaddr */
73 movl PCPU(COPYOUT_BUF),%eax
76 movl 16(%ebp),%eax /* len */
83 /* bcopy(%esi = kaddr, %edi = PCPU(copyout_buf), %ecx = len) */
92 /* bcopy(%esi = PCPU(copyout_buf), %edi = udaddr, %ecx = len) */
117 movl $copyout_fault,%edx
118 movl 20(%ebp),%ebx /* KCR3 */
120 movl PCPU(CURPCB),%eax
121 movl PCB_CR3(%eax),%edi
124 movl PCPU(TRAMPSTK),%esi
125 movl PCPU(COPYOUT_BUF),%eax
128 movl 12(%ebp),%eax /* kaddr */
131 movl 16(%ebp),%eax /* len */
135 movl 8(%ebp),%eax /* udaddr */
138 movl PCPU(COPYOUT_BUF),%eax
141 movl 16(%ebp),%eax /* len */
149 /* bcopy(%esi = udaddr, %edi = PCPU(copyout_buf), %ecx = len) */
157 /* bcopy(%esi = PCPU(copyout_buf), %edi = kaddr, %ecx = len) */
191 movl 8(%ebp),%ecx /* from */
192 movl PCPU(CURPCB),%eax
193 movl PCB_CR3(%eax),%eax
198 movl PCPU(TRAMPSTK),%esp
200 pf_x3: movl (%ecx),%eax
220 movl 8(%ebp),%ecx /* from */
221 movl PCPU(CURPCB),%eax
222 movl PCB_CR3(%eax),%eax
227 movl PCPU(TRAMPSTK),%esp
229 pf_x4: movzwl (%ecx),%eax
246 movl 8(%ebp),%ecx /* from */
247 movl PCPU(CURPCB),%eax
248 movl PCB_CR3(%eax),%eax
253 movl PCPU(TRAMPSTK),%esp
255 pf_x5: movzbl (%ecx),%eax
284 movl PCPU(CURPCB),%eax
285 movl PCB_CR3(%eax),%eax
287 movl 8(%ebp),%ecx /* to */
288 movl 12(%ebp),%edi /* val */
292 movl PCPU(TRAMPSTK),%esp
294 pf_x6: movl %edi,(%ecx)
312 movl PCPU(CURPCB),%eax
313 movl PCB_CR3(%eax),%eax
315 movl 8(%ebp),%ecx /* to */
316 movl 12(%ebp),%edi /* val */
320 movl PCPU(TRAMPSTK),%esp
322 pf_x7: movw %di,(%ecx)
340 movl PCPU(CURPCB),%eax
341 movl PCB_CR3(%eax),%eax
343 movl 8(%ebp),%ecx /* to */
344 movl 12(%ebp),%edi /* val */
348 movl PCPU(TRAMPSTK),%esp
351 pf_x8: movb %al,(%ecx)