File tree 1 file changed +37
-0
lines changed
1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 8
8
#include "funcdata.h"
9
9
#include "textflag.h"
10
10
11
+ #ifdef GOARM64_LSE
12
+ DATA no_lse_msg<> + 0x00 (SB)/ 64 , $ "This program can only run on ARM64 processors with LSE support.\n"
13
+ GLOBL no_lse_msg<>(SB) , RODATA , $ 64
14
+ #endif
15
+
11
16
TEXT runtime·rt0_go(SB) , NOSPLIT|TOPFRAME , $ 0
12
17
// SP = stack ; R0 = argc; R1 = argv
13
18
@@ -77,6 +82,21 @@ nocgo:
77
82
BL runtime·wintls(SB)
78
83
#endif
79
84
85
+ // Check th at CPU we use for execution supports instructions targeted during compile - time.
86
+ #ifdef GOARM64_LSE
87
+ #ifndef GOOS_openbsd
88
+ // Read the ID_AA64ISAR0_EL1 register
89
+ MRS ID_AA64ISAR0_EL1 , R0
90
+
91
+ // Extract the LSE field (bits [ 23 : 20 ] )
92
+ LSR $ 20 , R0 , R0
93
+ AND $ 0xf , R0 , R0
94
+
95
+ // LSE support is indicated by a non - zero value
96
+ CBZ R0 , no_lse
97
+ #endif
98
+ #endif
99
+
80
100
MOVW 8 ( RSP ) , R0 // copy argc
81
101
MOVW R0 , - 8 ( RSP )
82
102
MOVD 16 ( RSP ) , R0 // copy argv
@@ -95,6 +115,23 @@ nocgo:
95
115
96
116
// start this M
97
117
BL runtime·mstart(SB)
118
+ RET
119
+
120
+ #ifdef GOARM64_LSE
121
+ #ifndef GOOS_openbsd
122
+ no_lse:
123
+ MOVD $ 1 , R0 // stderr
124
+ MOVD R0 , 8 ( RSP )
125
+ MOVD $ no_lse_msg<>(SB) , R1 // message address
126
+ MOVD R1 , 16 ( RSP )
127
+ MOVD $ 64 , R2 // message length
128
+ MOVD R2 , 24 ( RSP )
129
+ CALL runtime·write(SB)
130
+ CALL runtime·exit(SB)
131
+ CALL runtime·abort(SB)
132
+ RET
133
+ #endif
134
+ #endif
98
135
99
136
// Prevent dead - code elimination of debugCallV2 and debugPinnerV1 , which are
100
137
// intended to be called by debuggers.
You can’t perform that action at this time.
0 commit comments