Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S
48378 views
1
/*
2
* CDDL HEADER START
3
*
4
* The contents of this file are subject to the terms of the
5
* Common Development and Distribution License, Version 1.0 only
6
* (the "License"). You may not use this file except in compliance
7
* with the License.
8
*
9
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10
* or http://www.opensolaris.org/os/licensing.
11
* See the License for the specific language governing permissions
12
* and limitations under the License.
13
*
14
* When distributing Covered Code, include this CDDL HEADER in each
15
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16
* If applicable, add the following below this CDDL HEADER, with the
17
* fields enclosed by brackets "[]" replaced with your own identifying
18
* information: Portions Copyright [yyyy] [name of copyright owner]
19
*
20
* CDDL HEADER END
21
*/
22
/*
23
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24
* Use is subject to license terms.
25
*/
26
27
#define _ASM
28
#define _LOCORE
29
30
#include <sys/cpuvar_defs.h>
31
#include <sys/dtrace.h>
32
#include <sys/elf_common.h>
33
34
#include <machine/armreg.h>
35
#include <machine/asm.h>
36
37
#include "assym.inc"
38
39
/*
40
void dtrace_membar_producer(void)
41
*/
42
ENTRY(dtrace_membar_producer)
43
RET
44
END(dtrace_membar_producer)
45
46
/*
47
void dtrace_membar_consumer(void)
48
*/
49
ENTRY(dtrace_membar_consumer)
50
RET
51
END(dtrace_membar_consumer)
52
53
/*
54
dtrace_icookie_t dtrace_interrupt_disable(void)
55
*/
56
ENTRY(dtrace_interrupt_disable)
57
mrs x0, daif
58
msr daifset, #2
59
RET
60
END(dtrace_interrupt_disable)
61
62
/*
63
void dtrace_interrupt_enable(dtrace_icookie_t cookie)
64
*/
65
ENTRY(dtrace_interrupt_enable)
66
msr daif, x0
67
RET
68
END(dtrace_interrupt_enable)
69
/*
70
uint8_t
71
dtrace_fuword8_nocheck(void *addr)
72
*/
73
ENTRY(dtrace_fuword8_nocheck)
74
ldtrb w0, [x0]
75
RET
76
END(dtrace_fuword8_nocheck)
77
78
/*
79
uint16_t
80
dtrace_fuword16_nocheck(void *addr)
81
*/
82
ENTRY(dtrace_fuword16_nocheck)
83
ldtrh w0, [x0]
84
RET
85
END(dtrace_fuword16_nocheck)
86
87
/*
88
uint32_t
89
dtrace_fuword32_nocheck(void *addr)
90
*/
91
ENTRY(dtrace_fuword32_nocheck)
92
ldtr w0, [x0]
93
RET
94
END(dtrace_fuword32_nocheck)
95
96
/*
97
uint64_t
98
dtrace_fuword64_nocheck(void *addr)
99
*/
100
ENTRY(dtrace_fuword64_nocheck)
101
ldtr x0, [x0]
102
RET
103
END(dtrace_fuword64_nocheck)
104
105
/*
106
void
107
dtrace_copy(uintptr_t uaddr, uintptr_t kaddr, size_t size)
108
*/
109
ENTRY(dtrace_copy)
110
cbz x2, 2f /* If len == 0 then skip loop */
111
1:
112
ldtrb w4, [x0] /* Load from uaddr */
113
add x0, x0, #1
114
strb w4, [x1], #1 /* Store in kaddr */
115
sub x2, x2, #1 /* len-- */
116
cbnz x2, 1b
117
2:
118
RET
119
END(dtrace_copy)
120
121
/*
122
void
123
dtrace_copystr(uintptr_t uaddr, uintptr_t kaddr, size_t size,
124
volatile uint16_t *flags)
125
XXX: Check for flags?
126
*/
127
ENTRY(dtrace_copystr)
128
cbz x2, 2f /* If len == 0 then skip loop */
129
1:
130
ldtrb w4, [x0] /* Load from uaddr */
131
add x0, x0, #1
132
strb w4, [x1], #1 /* Store in kaddr */
133
cbz w4, 2f /* If == 0 then break */
134
sub x2, x2, #1 /* len-- */
135
cbnz x2, 1b
136
2:
137
RET
138
END(dtrace_copystr)
139
140
/*
141
uintptr_t
142
dtrace_caller(int aframes)
143
*/
144
ENTRY(dtrace_caller)
145
mov x0, #-1
146
RET
147
END(dtrace_caller)
148
149
/*
150
uint32_t
151
dtrace_cas32(uint32_t *target, uint32_t cmp, uint32_t new)
152
*/
153
ENTRY(dtrace_cas32)
154
1: ldxr w3, [x0] /* Load target */
155
cmp w3, w1 /* Check if *target == cmp */
156
bne 2f /* No, return */
157
stxr w12, w2, [x0] /* Store new to target */
158
cbnz w12, 1b /* Try again if store not succeed */
159
2: mov w0, w3 /* Return the value loaded from target */
160
RET
161
END(dtrace_cas32)
162
163
/*
164
void *
165
dtrace_casptr(volatile void *target, volatile void *cmp, volatile void *new)
166
*/
167
ENTRY(dtrace_casptr)
168
1: ldxr x3, [x0] /* Load target */
169
cmp x3, x1 /* Check if *target == cmp */
170
bne 2f /* No, return */
171
stxr w12, x2, [x0] /* Store new to target */
172
cbnz w12, 1b /* Try again if store not succeed */
173
2: mov x0, x3 /* Return the value loaded from target */
174
RET
175
END(dtrace_casptr)
176
177
GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
178
179