4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 * Copyright 2015 Joyent, Inc.
29 #include <sys/asm_linkage.h>
30 #include <sys/regset.h>
37 ENTRY_NP
(dtrace_getfp
)
40 SET_SIZE
(dtrace_getfp
)
44 ENTRY_NP
(dtrace_getfp
)
47 SET_SIZE
(dtrace_getfp
)
55 ENTRY_NP
(dtrace_getvmreg
)
61 SET_SIZE
(dtrace_getvmreg
)
65 ENTRY_NP
(dtrace_getvmreg
)
66 pushl
%ebp
/ Setup stack frame
69 movl
12(%ebp
), %eax
/ Load flag pointer
70 movw
(%eax
), %cx
/ Load flags
71 orw $CPU_DTRACE_ILLOP
, %cx
/ Set ILLOP
72 movw
%cx
, (%eax
) / Store flags
76 SET_SIZE
(dtrace_getvmreg
)
89 SET_SIZE
(dtrace_cas32
)
96 SET_SIZE
(dtrace_casptr
)
101 ALTENTRY
(dtrace_casptr
)
106 cmpxchgl
%ecx
, (%edx
)
108 SET_SIZE
(dtrace_casptr
)
109 SET_SIZE
(dtrace_cas32
)
118 SET_SIZE
(dtrace_caller
)
120 #elif defined(__i386)
125 SET_SIZE
(dtrace_caller
)
137 xchgq
%rdi
, %rsi
/* make %rsi source, %rdi dest */
138 movq
%rdx
, %rcx
/* load count */
139 repz
/* repeat for count ... */
140 smovb
/* move from %ds:rsi to %ed:rdi */
144 SET_SIZE
(dtrace_copy
)
146 #elif defined(__i386)
154 movl
8(%ebp
), %esi
/ Load source address
155 movl
12(%ebp
), %edi
/ Load destination address
156 movl
16(%ebp
), %ecx
/ Load count
157 repz
/ Repeat for count.
..
158 smovb
/ move from
%ds
:si to
%es
:di
165 SET_SIZE
(dtrace_copy
)
172 ENTRY
(dtrace_copystr
)
177 movb
(%rdi
), %al
/* load from source */
178 movb
%al
, (%rsi
) /* store to destination */
179 addq $
1, %rdi
/* increment source pointer */
180 addq $
1, %rsi
/* increment destination pointer */
181 subq $
1, %rdx
/* decrement remaining count */
184 testq $
0xfff, %rdx
/* test if count is 4k-aligned */
185 jnz
1f
/* if not, continue with copying */
186 testq $CPU_DTRACE_BADADDR
, (%rcx
) /* load and test dtrace flags */
196 SET_SIZE
(dtrace_copystr
)
198 #elif defined(__i386)
200 ENTRY
(dtrace_copystr
)
202 pushl
%ebp
/ Setup stack frame
204 pushl
%ebx
/ Save registers
206 movl
8(%ebp
), %ebx
/ Load source address
207 movl
12(%ebp
), %edx
/ Load destination address
208 movl
16(%ebp
), %ecx
/ Load count
211 movb
(%ebx
), %al
/ Load from source
212 movb
%al
, (%edx
) / Store to destination
213 incl
%ebx
/ Increment source pointer
214 incl
%edx
/ Increment destination pointer
215 decl
%ecx
/ Decrement remaining count
218 testl $
0xfff, %ecx
/ Check if count is
4k-aligned
220 movl
20(%ebp
), %eax
/ load flags pointer
221 testl $CPU_DTRACE_BADADDR
, (%eax
) / load
and test dtrace flags
233 SET_SIZE
(dtrace_copystr
)
239 ENTRY
(dtrace_fulword
)
244 SET_SIZE
(dtrace_fulword
)
246 #elif defined(__i386)
248 ENTRY
(dtrace_fulword
)
253 SET_SIZE
(dtrace_fulword
)
259 ENTRY
(dtrace_fuword8_nocheck
)
265 SET_SIZE
(dtrace_fuword8_nocheck
)
267 #elif defined(__i386)
269 ENTRY
(dtrace_fuword8_nocheck
)
274 SET_SIZE
(dtrace_fuword8_nocheck
)
280 ENTRY
(dtrace_fuword16_nocheck
)
286 SET_SIZE
(dtrace_fuword16_nocheck
)
288 #elif defined(__i386)
290 ENTRY
(dtrace_fuword16_nocheck
)
295 SET_SIZE
(dtrace_fuword16_nocheck
)
301 ENTRY
(dtrace_fuword32_nocheck
)
307 SET_SIZE
(dtrace_fuword32_nocheck
)
309 #elif defined(__i386)
311 ENTRY
(dtrace_fuword32_nocheck
)
316 SET_SIZE
(dtrace_fuword32_nocheck
)
322 ENTRY
(dtrace_fuword64_nocheck
)
327 SET_SIZE
(dtrace_fuword64_nocheck
)
329 #elif defined(__i386)
331 ENTRY
(dtrace_fuword64_nocheck
)
338 SET_SIZE
(dtrace_fuword64_nocheck
)
344 ENTRY
(dtrace_probe_error
)
354 movl dtrace_probeid_error
(%rip
), %edi
359 SET_SIZE
(dtrace_probe_error
)
361 #elif defined(__i386)
363 ENTRY
(dtrace_probe_error
)
372 pushl dtrace_probeid_error
377 SET_SIZE
(dtrace_probe_error
)