Text file
src/runtime/secret_arm64.s
1 // Copyright 2024 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 #include "go_asm.h"
6 #include "textflag.h"
7 #include "funcdata.h"
8
9 TEXT ·secretEraseRegisters(SB),NOFRAME|NOSPLIT,$0-0
10 MOVD ZR, R0
11 MOVD ZR, R26
12 JMP ·secretEraseRegistersMcall(SB)
13
14 // Mcall requires an argument in R0 and does not have a
15 // stack frame to spill into. Additionally, there is no stack
16 // to spill the link register into. This function deliberately
17 // doesn't clear R0 and R26, and Mcall uses R26 as a link register.
18 TEXT ·secretEraseRegistersMcall(SB),NOFRAME|NOSPLIT,$0-0
19 // integer registers
20 MOVD ZR, R1
21 MOVD ZR, R2
22 MOVD ZR, R3
23 MOVD ZR, R4
24 MOVD ZR, R5
25 MOVD ZR, R6
26 MOVD ZR, R7
27 MOVD ZR, R8
28 MOVD ZR, R9
29 MOVD ZR, R10
30 MOVD ZR, R11
31 MOVD ZR, R12
32 MOVD ZR, R13
33 MOVD ZR, R14
34 MOVD ZR, R15
35 MOVD ZR, R16
36 MOVD ZR, R17
37 // R18 = platform register
38 MOVD ZR, R19
39 MOVD ZR, R20
40 MOVD ZR, R21
41 MOVD ZR, R22
42 MOVD ZR, R23
43 MOVD ZR, R24
44 MOVD ZR, R25
45 // R26 used for extra link register in mcall where we can't spill
46 MOVD ZR, R27
47 // R28 = g
48 // R29 = frame pointer
49 // R30 = link pointer (return address)
50 // R31 = stack pointer
51
52 // floating point registers
53 // (also clears simd registers)
54 FMOVD ZR, F0
55 FMOVD ZR, F1
56 FMOVD ZR, F2
57 FMOVD ZR, F3
58 FMOVD ZR, F4
59 FMOVD ZR, F5
60 FMOVD ZR, F6
61 FMOVD ZR, F7
62 FMOVD ZR, F8
63 FMOVD ZR, F9
64 FMOVD ZR, F10
65 FMOVD ZR, F11
66 FMOVD ZR, F12
67 FMOVD ZR, F13
68 FMOVD ZR, F14
69 FMOVD ZR, F15
70 FMOVD ZR, F16
71 FMOVD ZR, F17
72 FMOVD ZR, F18
73 FMOVD ZR, F19
74 FMOVD ZR, F20
75 FMOVD ZR, F21
76 FMOVD ZR, F22
77 FMOVD ZR, F23
78 FMOVD ZR, F24
79 FMOVD ZR, F25
80 FMOVD ZR, F26
81 FMOVD ZR, F27
82 FMOVD ZR, F28
83 FMOVD ZR, F29
84 FMOVD ZR, F30
85 FMOVD ZR, F31
86
87 // misc registers
88 CMP ZR, ZR // N,Z,C,V flags
89
90 RET
91
View as plain text