]>
Commit | Line | Data |
---|---|---|
adffaa8e SP |
1 | // Zero/one operands |
2 | ||
3 | bx #4 | |
4 | ret | |
5 | ||
6 | // Single operand (n) | |
7 | ||
8 | .macro morello_jump cn | |
9 | .irp op, blr, blrr, blrs, br, brr, brs, ret, retr, rets | |
10 | \op \cn | |
11 | .endr | |
12 | .endm | |
13 | morello_jump c20 | |
14 | ||
1ef7b7e1 SP |
15 | .macro morello_csp cnsp |
16 | .irp op, chksld, chktgd | |
17 | \op \cnsp | |
18 | .endr | |
19 | .endm | |
20 | morello_csp csp | |
21 | ||
ec145252 SP |
22 | // Two operands (dn). |
23 | ||
24 | .macro morello_cspcsp cdsp, cnsp | |
3e2ac3d2 | 25 | .irp op, cpy, mov, chkss, clrtag |
ec145252 SP |
26 | \op \cdsp, \cnsp |
27 | .endr | |
28 | .endm | |
29 | morello_cspcsp c11, c19 | |
30 | morello_cspcsp c11, csp | |
31 | morello_cspcsp csp, c11 | |
32 | morello_cspcsp csp, csp | |
33 | ||
34 | mov c0, czr | |
dc64c2ba | 35 | |
1ef7b7e1 SP |
36 | .macro morello_cx cd, xn |
37 | .irp op, cvtd, cvtdz, cvtp, cvtpz | |
38 | \op \cd, \xn | |
39 | .endr | |
40 | .endm | |
41 | morello_cx c0, x1 | |
42 | ||
43 | .macro morello_xx xd, xn | |
44 | .irp op, rrlen, rrmask | |
45 | \op \xd, \xn | |
46 | .endr | |
47 | .endm | |
48 | morello_xx x2, x1 | |
49 | ||
50 | .macro morello_xcsp xd, cnsp | |
51 | .irp op, cfhi, cvtd, cvtp | |
52 | \op \xd, \cnsp | |
53 | .endr | |
54 | .endm | |
55 | morello_xcsp x7, c15 | |
56 | morello_xcsp x6, csp | |
57 | ||
58 | .macro morello_gc_xc xd, cnsp | |
59 | .irp op, gcbase, gcflgs, gclen, gclim, gcoff, gcperm, gcseal, gctag, gctype, gcvalue | |
60 | \op \xd, \cnsp | |
61 | .endr | |
62 | .endm | |
63 | morello_gc_xc x7, c15 | |
64 | morello_gc_xc x6, csp | |
65 | ||
66 | chkeq csp, c20 | |
67 | chkeq c19, c20 | |
68 | ||
321c4e1a SP |
69 | Label: |
70 | .macro morello_adrx cd | |
71 | .irp op, adr, adrp | |
72 | \op \cd, Label | |
73 | .endr | |
74 | .endm | |
459784de VDN |
75 | |
76 | .ifdef C64MODE | |
77 | morello_adrx c0 | |
78 | .else | |
79 | morello_adrx x0 | |
80 | .endif | |
321c4e1a SP |
81 | |
82 | .ifdef C64MODE | |
83 | adrdp c0, #4096 | |
84 | .endif | |
85 | ||
dc64c2ba SP |
86 | // Three operands (dni) |
87 | ||
88 | .macro morello_addsub_imm cdsp, cnsp | |
89 | .irp op, add, sub | |
90 | \op \cdsp, \cnsp, #0xff0 | |
91 | \op \cdsp, \cnsp, #0xfff, lsl #0 | |
92 | \op \cdsp, \cnsp, #0x1fe, lsl #12 | |
93 | \op \cdsp, \cnsp, #0x3, lsl #0 | |
94 | \op \cdsp, \cnsp, #0x0, lsl #12 | |
95 | .endr | |
96 | .endm | |
97 | morello_addsub_imm c21, c9 | |
98 | morello_addsub_imm csp, c9 | |
99 | morello_addsub_imm csp, csp | |
100 | morello_addsub_imm c21, csp | |
101 | ||
9e5e0b29 | 102 | .macro morello_cspcspi8 cdsp, cnsp |
1ef7b7e1 | 103 | .irp op, bicflgs, eorflgs, orrflgs |
9e5e0b29 SP |
104 | \op \cdsp, \cnsp, #0xff |
105 | \op \cdsp, \cnsp, #0 | |
106 | \op \cdsp, \cnsp, #0xff | |
107 | \op \cdsp, \cnsp, #0x10 | |
108 | .endr | |
109 | .endm | |
110 | morello_cspcspi8 c7, c6 | |
111 | morello_cspcspi8 csp, c6 | |
112 | morello_cspcspi8 c8, csp | |
113 | morello_cspcspi8 csp, csp | |
114 | ||
1ef7b7e1 | 115 | .macro morello_cspcspi6 cdsp, cnsp |
0bd71233 | 116 | .irp op, alignd, alignu, scbnds |
1ef7b7e1 SP |
117 | \op \cdsp, \cnsp, #0x3f |
118 | \op \cdsp, \cnsp, #0x1e | |
119 | \op \cdsp, \cnsp, #0 | |
120 | \op \cdsp, \cnsp, #0x20 | |
121 | .endr | |
122 | .endm | |
123 | morello_cspcspi6 c17, c16 | |
124 | morello_cspcspi6 csp, c16 | |
125 | morello_cspcspi6 c18, csp | |
126 | morello_cspcspi6 csp, csp | |
127 | ||
3e2ac3d2 SP |
128 | .macro morello_perm cd, cn |
129 | .irp perm, r, w, x, rx, wx, rw, rwx, #0, #1, #2, #3, #4, #5, #6, #7 | |
130 | clrperm \cd, \cn, \perm | |
131 | .endr | |
132 | .endm | |
133 | morello_perm c22, c23 | |
134 | ||
0bd71233 SP |
135 | .macro morello_scbnds cdsp, cnsp |
136 | scbnds \cdsp, \cnsp, #0x3f, lsl #4 | |
137 | scbnds \cdsp, \cnsp, #0x1e, lsl #4 | |
138 | scbnds \cdsp, \cnsp, #0, lsl #4 | |
139 | scbnds \cdsp, \cnsp, #0x20, lsl #4 | |
140 | scbnds \cdsp, \cnsp, #0x3f0 | |
141 | scbnds \cdsp, \cnsp, #0x40 | |
142 | .endm | |
143 | morello_scbnds c17, c16 | |
144 | morello_scbnds csp, c16 | |
145 | morello_scbnds c18, csp | |
146 | morello_scbnds csp, csp | |
147 | ||
7ce74d61 SP |
148 | .macro morello_seal cd, cn |
149 | .irp form, rb, lb, lpb | |
150 | seal \cd, \cn, \form | |
151 | .endr | |
152 | .endm | |
153 | morello_seal c2, c3 | |
154 | ||
9e5e0b29 SP |
155 | // Three operands (dnm) |
156 | ||
157 | .macro morello_cspcspx cdsp, cnsp, xm | |
0bd71233 | 158 | .irp op, bicflgs, eorflgs, orrflgs, clrperm, scbnds, scbndse, scoff, scflgs, sctag, scvalue |
9e5e0b29 SP |
159 | \op \cdsp, \cnsp, \xm |
160 | .endr | |
161 | .endm | |
162 | morello_cspcspx c7, c6, x25 | |
163 | morello_cspcspx c7, csp, x25 | |
164 | morello_cspcspx csp, c6, x25 | |
165 | morello_cspcspx csp, csp, x25 | |
166 | ||
1ef7b7e1 SP |
167 | subs x4, c13, c14 |
168 | ||
adffaa8e SP |
169 | .macro morello_jump_sealed cn, cm |
170 | .irp op, blrs, brs, rets | |
171 | \op c29, \cn, \cm | |
172 | .endr | |
173 | .endm | |
174 | morello_jump_sealed c2, c4 | |
175 | ||
1ef7b7e1 | 176 | .macro morello_ccc cd, cn, cm |
7ce74d61 | 177 | .irp op, cpytype, cpyvalue, seal, unseal |
1ef7b7e1 SP |
178 | \op \cd, \cn, \cm |
179 | .endr | |
180 | .endm | |
181 | morello_ccc c2, c4, c13 | |
182 | ||
183 | .macro morello_cspcx cdsp, cn, xm | |
184 | .irp op, cthi | |
185 | \op \cdsp, \cn, \xm | |
186 | .endr | |
187 | .endm | |
188 | morello_cspcx c0, c22, x25 | |
189 | morello_cspcx csp, c4, x25 | |
190 | ||
191 | .macro morello_ccspx cd, cnsp, xm | |
192 | .irp op, cvt, cvtz | |
193 | \op \cd, \cnsp, \xm | |
194 | .endr | |
195 | .endm | |
196 | morello_ccspx c22, c0, x25 | |
197 | morello_ccspx c4, csp, x25 | |
198 | ||
199 | .macro morello_xcspc xd, cnsp, cm | |
200 | .irp op, cvt | |
201 | \op \xd, \cnsp, \cm | |
202 | .endr | |
203 | .endm | |
204 | morello_xcspc x22, c0, c25 | |
205 | morello_xcspc x4, csp, c25 | |
206 | ||
207 | .macro morello_ccspcsp cd, cnsp, cmsp | |
208 | .irp op, chkssu | |
209 | \op \cd, \cnsp, \cmsp | |
210 | .endr | |
211 | .endm | |
212 | morello_ccspcsp c13, c7, c22 | |
213 | morello_ccspcsp c13, csp, c22 | |
214 | morello_ccspcsp c13, c7, csp | |
215 | morello_ccspcsp c13, csp, csp | |
216 | ||
217 | .macro morello_cspcspcsp cdsp, cnsp, cmsp | |
218 | .irp op, build, cseal | |
219 | \op \cdsp, \cnsp, \cmsp | |
220 | .endr | |
221 | .endm | |
222 | morello_cspcspcsp c2, c4, c13 | |
223 | morello_cspcspcsp csp, c4, c13 | |
224 | morello_cspcspcsp c2, csp, c13 | |
225 | morello_cspcspcsp csp, csp, c13 | |
226 | morello_cspcspcsp c2, c4, csp | |
227 | morello_cspcspcsp csp, c4, csp | |
228 | morello_cspcspcsp c2, csp, csp | |
229 | morello_cspcspcsp csp, csp, csp | |
230 | ||
dc64c2ba SP |
231 | // Four operands (dnmi) |
232 | ||
233 | .macro morello_add_scalar cspd, cspn, rm | |
234 | .irp op, add | |
235 | \op \cspd, \cspn, x\rm, sxtx #0 | |
236 | \op \cspd, \cspn, x\rm, sxtx #4 | |
237 | \op \cspd, \cspn, w\rm, sxtw #4 | |
238 | \op \cspd, \cspn, x\rm | |
239 | \op \cspd, \cspn, x\rm, lsl #4 | |
240 | .endr | |
241 | .endm | |
242 | morello_add_scalar c17, c9, 4 | |
243 | morello_add_scalar csp, c9, 4 | |
244 | morello_add_scalar c17, csp, 4 | |
245 | morello_add_scalar csp, csp, 4 | |
1ef7b7e1 SP |
246 | |
247 | .macro morello_csel cd, cn, cm | |
248 | .irp cond, EQ, NE, CS, HS, CC, LO, MI, PL, VS, VC, HI, LS, GE, LT, GT, LE, AL, NV | |
249 | csel \cd, \cn, \cm, \cond | |
250 | .endr | |
251 | .endm | |
252 | morello_csel c13, c7, c3 | |
801f0a7d SP |
253 | |
254 | // System register access | |
255 | ||
256 | mrs x22, ID_AA64PFR1_EL1 | |
257 | ||
258 | .macro morello_msx1 xt | |
259 | .irp sysreg, CCTLR_EL0, CCTLR_EL1, CCTLR_EL12, CCTLR_EL2, CCTLR_EL3, CHCR_EL2, CPACR_EL1, CPACR_EL12, CPTR_EL2, CPTR_EL3, CSCR_EL3, | |
260 | msr \sysreg, \xt | |
261 | mrs \xt, \sysreg | |
262 | .endr | |
263 | .endm | |
264 | morello_msx1 x19 | |
265 | ||
266 | .macro morello_msx2 xt | |
267 | .irp sysreg, ESR_EL1, ESR_EL12, ESR_EL2, ESR_EL3, RSP_EL0, RTPIDR_EL0, TPIDR_EL0, TPIDR_EL1, TPIDR_EL2, TPIDR_EL3 | |
268 | msr \sysreg, \xt | |
269 | mrs \xt, \sysreg | |
270 | .endr | |
271 | .endm | |
272 | morello_msx2 x2 | |
273 | ||
274 | .macro morello_ms_tp ct | |
275 | .irp sysreg, RCTPIDR_EL0, CTPIDR_EL0, CTPIDR_EL1, CTPIDR_EL2, CTPIDR_EL3, CTPIDRRO_EL0 | |
276 | msr \sysreg, \ct | |
277 | mrs \ct, \sysreg | |
278 | .endr | |
279 | .endm | |
280 | morello_ms_tp c19 | |
281 | ||
282 | .macro morello_ms_ddc ct | |
283 | .irp sysreg, DDC, DDC_EL0, DDC_EL1, DDC_EL2, RDDC_EL0 | |
284 | msr \sysreg, \ct | |
285 | mrs \ct, \sysreg | |
286 | .endr | |
287 | .endm | |
288 | morello_ms_ddc c19 | |
289 | ||
290 | .macro morello_ms_sp ct | |
291 | .irp sysreg, RCSP_EL0, CSP_EL0, CSP_EL1, CSP_EL2 | |
292 | msr \sysreg, \ct | |
293 | mrs \ct, \sysreg | |
294 | .endr | |
295 | .endm | |
296 | morello_ms_sp c19 | |
297 | ||
298 | .macro morello_ms_misc ct | |
299 | .irp sysreg, CDBGDTR_EL0, CDLR_EL0, CELR_EL1, CELR_EL12, CELR_EL2, CELR_EL3, CID_EL0, CVBAR_EL1, CVBAR_EL12, CVBAR_EL2, CVBAR_EL3 | |
300 | msr \sysreg, \ct | |
301 | mrs \ct, \sysreg | |
302 | .endr | |
303 | .endm | |
304 | morello_ms_misc c19 |