trampoline-armv8.S 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. // This file is generated from a similarly-named Perl script in the BoringSSL
  2. // source tree. Do not edit by hand.
  3. #if !defined(__has_feature)
  4. #define __has_feature(x) 0
  5. #endif
  6. #if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM)
  7. #define OPENSSL_NO_ASM
  8. #endif
  9. #if !defined(OPENSSL_NO_ASM)
  10. #if defined(__aarch64__)
  11. #if defined(BORINGSSL_PREFIX)
  12. #include <boringssl_prefix_symbols_asm.h>
  13. #endif
  14. #include <openssl/arm_arch.h>
  15. .text
  16. // abi_test_trampoline loads callee-saved registers from |state|, calls |func|
  17. // with |argv|, then saves the callee-saved registers into |state|. It returns
  18. // the result of |func|. The |unwind| argument is unused.
  19. // uint64_t abi_test_trampoline(void (*func)(...), CallerState *state,
  20. // const uint64_t *argv, size_t argc,
  21. // uint64_t unwind);
  22. .globl abi_test_trampoline
  23. .align 4
  24. abi_test_trampoline:
  25. Labi_test_trampoline_begin:
  26. AARCH64_SIGN_LINK_REGISTER
  27. // Stack layout (low to high addresses)
  28. // x29,x30 (16 bytes)
  29. // d8-d15 (64 bytes)
  30. // x19-x28 (80 bytes)
  31. // x1 (8 bytes)
  32. // padding (8 bytes)
  33. stp x29, x30, [sp, #-176]!
  34. mov x29, sp
  35. // Saved callee-saved registers and |state|.
  36. stp d8, d9, [sp, #16]
  37. stp d10, d11, [sp, #32]
  38. stp d12, d13, [sp, #48]
  39. stp d14, d15, [sp, #64]
  40. stp x19, x20, [sp, #80]
  41. stp x21, x22, [sp, #96]
  42. stp x23, x24, [sp, #112]
  43. stp x25, x26, [sp, #128]
  44. stp x27, x28, [sp, #144]
  45. str x1, [sp, #160]
  46. // Load registers from |state|, with the exception of x29. x29 is the
  47. // frame pointer and also callee-saved, but AAPCS64 allows platforms to
  48. // mandate that x29 always point to a frame. iOS64 does so, which means
  49. // we cannot fill x29 with entropy without violating ABI rules
  50. // ourselves. x29 is tested separately below.
  51. ldp d8, d9, [x1], #16
  52. ldp d10, d11, [x1], #16
  53. ldp d12, d13, [x1], #16
  54. ldp d14, d15, [x1], #16
  55. ldp x19, x20, [x1], #16
  56. ldp x21, x22, [x1], #16
  57. ldp x23, x24, [x1], #16
  58. ldp x25, x26, [x1], #16
  59. ldp x27, x28, [x1], #16
  60. // Move parameters into temporary registers.
  61. mov x9, x0
  62. mov x10, x2
  63. mov x11, x3
  64. // Load parameters into registers.
  65. cbz x11, Largs_done
  66. ldr x0, [x10], #8
  67. subs x11, x11, #1
  68. b.eq Largs_done
  69. ldr x1, [x10], #8
  70. subs x11, x11, #1
  71. b.eq Largs_done
  72. ldr x2, [x10], #8
  73. subs x11, x11, #1
  74. b.eq Largs_done
  75. ldr x3, [x10], #8
  76. subs x11, x11, #1
  77. b.eq Largs_done
  78. ldr x4, [x10], #8
  79. subs x11, x11, #1
  80. b.eq Largs_done
  81. ldr x5, [x10], #8
  82. subs x11, x11, #1
  83. b.eq Largs_done
  84. ldr x6, [x10], #8
  85. subs x11, x11, #1
  86. b.eq Largs_done
  87. ldr x7, [x10], #8
  88. Largs_done:
  89. blr x9
  90. // Reload |state| and store registers.
  91. ldr x1, [sp, #160]
  92. stp d8, d9, [x1], #16
  93. stp d10, d11, [x1], #16
  94. stp d12, d13, [x1], #16
  95. stp d14, d15, [x1], #16
  96. stp x19, x20, [x1], #16
  97. stp x21, x22, [x1], #16
  98. stp x23, x24, [x1], #16
  99. stp x25, x26, [x1], #16
  100. stp x27, x28, [x1], #16
  101. // |func| is required to preserve x29, the frame pointer. We cannot load
  102. // random values into x29 (see comment above), so compare it against the
  103. // expected value and zero the field of |state| if corrupted.
  104. mov x9, sp
  105. cmp x29, x9
  106. b.eq Lx29_ok
  107. str xzr, [x1]
  108. Lx29_ok:
  109. // Restore callee-saved registers.
  110. ldp d8, d9, [sp, #16]
  111. ldp d10, d11, [sp, #32]
  112. ldp d12, d13, [sp, #48]
  113. ldp d14, d15, [sp, #64]
  114. ldp x19, x20, [sp, #80]
  115. ldp x21, x22, [sp, #96]
  116. ldp x23, x24, [sp, #112]
  117. ldp x25, x26, [sp, #128]
  118. ldp x27, x28, [sp, #144]
  119. ldp x29, x30, [sp], #176
  120. AARCH64_VALIDATE_LINK_REGISTER
  121. ret
  122. .globl abi_test_clobber_x0
  123. .align 4
  124. abi_test_clobber_x0:
  125. AARCH64_VALID_CALL_TARGET
  126. mov x0, xzr
  127. ret
  128. .globl abi_test_clobber_x1
  129. .align 4
  130. abi_test_clobber_x1:
  131. AARCH64_VALID_CALL_TARGET
  132. mov x1, xzr
  133. ret
  134. .globl abi_test_clobber_x2
  135. .align 4
  136. abi_test_clobber_x2:
  137. AARCH64_VALID_CALL_TARGET
  138. mov x2, xzr
  139. ret
  140. .globl abi_test_clobber_x3
  141. .align 4
  142. abi_test_clobber_x3:
  143. AARCH64_VALID_CALL_TARGET
  144. mov x3, xzr
  145. ret
  146. .globl abi_test_clobber_x4
  147. .align 4
  148. abi_test_clobber_x4:
  149. AARCH64_VALID_CALL_TARGET
  150. mov x4, xzr
  151. ret
  152. .globl abi_test_clobber_x5
  153. .align 4
  154. abi_test_clobber_x5:
  155. AARCH64_VALID_CALL_TARGET
  156. mov x5, xzr
  157. ret
  158. .globl abi_test_clobber_x6
  159. .align 4
  160. abi_test_clobber_x6:
  161. AARCH64_VALID_CALL_TARGET
  162. mov x6, xzr
  163. ret
  164. .globl abi_test_clobber_x7
  165. .align 4
  166. abi_test_clobber_x7:
  167. AARCH64_VALID_CALL_TARGET
  168. mov x7, xzr
  169. ret
  170. .globl abi_test_clobber_x8
  171. .align 4
  172. abi_test_clobber_x8:
  173. AARCH64_VALID_CALL_TARGET
  174. mov x8, xzr
  175. ret
  176. .globl abi_test_clobber_x9
  177. .align 4
  178. abi_test_clobber_x9:
  179. AARCH64_VALID_CALL_TARGET
  180. mov x9, xzr
  181. ret
  182. .globl abi_test_clobber_x10
  183. .align 4
  184. abi_test_clobber_x10:
  185. AARCH64_VALID_CALL_TARGET
  186. mov x10, xzr
  187. ret
  188. .globl abi_test_clobber_x11
  189. .align 4
  190. abi_test_clobber_x11:
  191. AARCH64_VALID_CALL_TARGET
  192. mov x11, xzr
  193. ret
  194. .globl abi_test_clobber_x12
  195. .align 4
  196. abi_test_clobber_x12:
  197. AARCH64_VALID_CALL_TARGET
  198. mov x12, xzr
  199. ret
  200. .globl abi_test_clobber_x13
  201. .align 4
  202. abi_test_clobber_x13:
  203. AARCH64_VALID_CALL_TARGET
  204. mov x13, xzr
  205. ret
  206. .globl abi_test_clobber_x14
  207. .align 4
  208. abi_test_clobber_x14:
  209. AARCH64_VALID_CALL_TARGET
  210. mov x14, xzr
  211. ret
  212. .globl abi_test_clobber_x15
  213. .align 4
  214. abi_test_clobber_x15:
  215. AARCH64_VALID_CALL_TARGET
  216. mov x15, xzr
  217. ret
  218. .globl abi_test_clobber_x16
  219. .align 4
  220. abi_test_clobber_x16:
  221. AARCH64_VALID_CALL_TARGET
  222. mov x16, xzr
  223. ret
  224. .globl abi_test_clobber_x17
  225. .align 4
  226. abi_test_clobber_x17:
  227. AARCH64_VALID_CALL_TARGET
  228. mov x17, xzr
  229. ret
  230. .globl abi_test_clobber_x19
  231. .align 4
  232. abi_test_clobber_x19:
  233. AARCH64_VALID_CALL_TARGET
  234. mov x19, xzr
  235. ret
  236. .globl abi_test_clobber_x20
  237. .align 4
  238. abi_test_clobber_x20:
  239. AARCH64_VALID_CALL_TARGET
  240. mov x20, xzr
  241. ret
  242. .globl abi_test_clobber_x21
  243. .align 4
  244. abi_test_clobber_x21:
  245. AARCH64_VALID_CALL_TARGET
  246. mov x21, xzr
  247. ret
  248. .globl abi_test_clobber_x22
  249. .align 4
  250. abi_test_clobber_x22:
  251. AARCH64_VALID_CALL_TARGET
  252. mov x22, xzr
  253. ret
  254. .globl abi_test_clobber_x23
  255. .align 4
  256. abi_test_clobber_x23:
  257. AARCH64_VALID_CALL_TARGET
  258. mov x23, xzr
  259. ret
  260. .globl abi_test_clobber_x24
  261. .align 4
  262. abi_test_clobber_x24:
  263. AARCH64_VALID_CALL_TARGET
  264. mov x24, xzr
  265. ret
  266. .globl abi_test_clobber_x25
  267. .align 4
  268. abi_test_clobber_x25:
  269. AARCH64_VALID_CALL_TARGET
  270. mov x25, xzr
  271. ret
  272. .globl abi_test_clobber_x26
  273. .align 4
  274. abi_test_clobber_x26:
  275. AARCH64_VALID_CALL_TARGET
  276. mov x26, xzr
  277. ret
  278. .globl abi_test_clobber_x27
  279. .align 4
  280. abi_test_clobber_x27:
  281. AARCH64_VALID_CALL_TARGET
  282. mov x27, xzr
  283. ret
  284. .globl abi_test_clobber_x28
  285. .align 4
  286. abi_test_clobber_x28:
  287. AARCH64_VALID_CALL_TARGET
  288. mov x28, xzr
  289. ret
  290. .globl abi_test_clobber_x29
  291. .align 4
  292. abi_test_clobber_x29:
  293. AARCH64_VALID_CALL_TARGET
  294. mov x29, xzr
  295. ret
  296. .globl abi_test_clobber_d0
  297. .align 4
  298. abi_test_clobber_d0:
  299. AARCH64_VALID_CALL_TARGET
  300. fmov d0, xzr
  301. ret
  302. .globl abi_test_clobber_d1
  303. .align 4
  304. abi_test_clobber_d1:
  305. AARCH64_VALID_CALL_TARGET
  306. fmov d1, xzr
  307. ret
  308. .globl abi_test_clobber_d2
  309. .align 4
  310. abi_test_clobber_d2:
  311. AARCH64_VALID_CALL_TARGET
  312. fmov d2, xzr
  313. ret
  314. .globl abi_test_clobber_d3
  315. .align 4
  316. abi_test_clobber_d3:
  317. AARCH64_VALID_CALL_TARGET
  318. fmov d3, xzr
  319. ret
  320. .globl abi_test_clobber_d4
  321. .align 4
  322. abi_test_clobber_d4:
  323. AARCH64_VALID_CALL_TARGET
  324. fmov d4, xzr
  325. ret
  326. .globl abi_test_clobber_d5
  327. .align 4
  328. abi_test_clobber_d5:
  329. AARCH64_VALID_CALL_TARGET
  330. fmov d5, xzr
  331. ret
  332. .globl abi_test_clobber_d6
  333. .align 4
  334. abi_test_clobber_d6:
  335. AARCH64_VALID_CALL_TARGET
  336. fmov d6, xzr
  337. ret
  338. .globl abi_test_clobber_d7
  339. .align 4
  340. abi_test_clobber_d7:
  341. AARCH64_VALID_CALL_TARGET
  342. fmov d7, xzr
  343. ret
  344. .globl abi_test_clobber_d8
  345. .align 4
  346. abi_test_clobber_d8:
  347. AARCH64_VALID_CALL_TARGET
  348. fmov d8, xzr
  349. ret
  350. .globl abi_test_clobber_d9
  351. .align 4
  352. abi_test_clobber_d9:
  353. AARCH64_VALID_CALL_TARGET
  354. fmov d9, xzr
  355. ret
  356. .globl abi_test_clobber_d10
  357. .align 4
  358. abi_test_clobber_d10:
  359. AARCH64_VALID_CALL_TARGET
  360. fmov d10, xzr
  361. ret
  362. .globl abi_test_clobber_d11
  363. .align 4
  364. abi_test_clobber_d11:
  365. AARCH64_VALID_CALL_TARGET
  366. fmov d11, xzr
  367. ret
  368. .globl abi_test_clobber_d12
  369. .align 4
  370. abi_test_clobber_d12:
  371. AARCH64_VALID_CALL_TARGET
  372. fmov d12, xzr
  373. ret
  374. .globl abi_test_clobber_d13
  375. .align 4
  376. abi_test_clobber_d13:
  377. AARCH64_VALID_CALL_TARGET
  378. fmov d13, xzr
  379. ret
  380. .globl abi_test_clobber_d14
  381. .align 4
  382. abi_test_clobber_d14:
  383. AARCH64_VALID_CALL_TARGET
  384. fmov d14, xzr
  385. ret
  386. .globl abi_test_clobber_d15
  387. .align 4
  388. abi_test_clobber_d15:
  389. AARCH64_VALID_CALL_TARGET
  390. fmov d15, xzr
  391. ret
  392. .globl abi_test_clobber_d16
  393. .align 4
  394. abi_test_clobber_d16:
  395. AARCH64_VALID_CALL_TARGET
  396. fmov d16, xzr
  397. ret
  398. .globl abi_test_clobber_d17
  399. .align 4
  400. abi_test_clobber_d17:
  401. AARCH64_VALID_CALL_TARGET
  402. fmov d17, xzr
  403. ret
  404. .globl abi_test_clobber_d18
  405. .align 4
  406. abi_test_clobber_d18:
  407. AARCH64_VALID_CALL_TARGET
  408. fmov d18, xzr
  409. ret
  410. .globl abi_test_clobber_d19
  411. .align 4
  412. abi_test_clobber_d19:
  413. AARCH64_VALID_CALL_TARGET
  414. fmov d19, xzr
  415. ret
  416. .globl abi_test_clobber_d20
  417. .align 4
  418. abi_test_clobber_d20:
  419. AARCH64_VALID_CALL_TARGET
  420. fmov d20, xzr
  421. ret
  422. .globl abi_test_clobber_d21
  423. .align 4
  424. abi_test_clobber_d21:
  425. AARCH64_VALID_CALL_TARGET
  426. fmov d21, xzr
  427. ret
  428. .globl abi_test_clobber_d22
  429. .align 4
  430. abi_test_clobber_d22:
  431. AARCH64_VALID_CALL_TARGET
  432. fmov d22, xzr
  433. ret
  434. .globl abi_test_clobber_d23
  435. .align 4
  436. abi_test_clobber_d23:
  437. AARCH64_VALID_CALL_TARGET
  438. fmov d23, xzr
  439. ret
  440. .globl abi_test_clobber_d24
  441. .align 4
  442. abi_test_clobber_d24:
  443. AARCH64_VALID_CALL_TARGET
  444. fmov d24, xzr
  445. ret
  446. .globl abi_test_clobber_d25
  447. .align 4
  448. abi_test_clobber_d25:
  449. AARCH64_VALID_CALL_TARGET
  450. fmov d25, xzr
  451. ret
  452. .globl abi_test_clobber_d26
  453. .align 4
  454. abi_test_clobber_d26:
  455. AARCH64_VALID_CALL_TARGET
  456. fmov d26, xzr
  457. ret
  458. .globl abi_test_clobber_d27
  459. .align 4
  460. abi_test_clobber_d27:
  461. AARCH64_VALID_CALL_TARGET
  462. fmov d27, xzr
  463. ret
  464. .globl abi_test_clobber_d28
  465. .align 4
  466. abi_test_clobber_d28:
  467. AARCH64_VALID_CALL_TARGET
  468. fmov d28, xzr
  469. ret
  470. .globl abi_test_clobber_d29
  471. .align 4
  472. abi_test_clobber_d29:
  473. AARCH64_VALID_CALL_TARGET
  474. fmov d29, xzr
  475. ret
  476. .globl abi_test_clobber_d30
  477. .align 4
  478. abi_test_clobber_d30:
  479. AARCH64_VALID_CALL_TARGET
  480. fmov d30, xzr
  481. ret
  482. .globl abi_test_clobber_d31
  483. .align 4
  484. abi_test_clobber_d31:
  485. AARCH64_VALID_CALL_TARGET
  486. fmov d31, xzr
  487. ret
  488. .globl abi_test_clobber_v8_upper
  489. .align 4
  490. abi_test_clobber_v8_upper:
  491. AARCH64_VALID_CALL_TARGET
  492. fmov v8.d[1], xzr
  493. ret
  494. .globl abi_test_clobber_v9_upper
  495. .align 4
  496. abi_test_clobber_v9_upper:
  497. AARCH64_VALID_CALL_TARGET
  498. fmov v9.d[1], xzr
  499. ret
  500. .globl abi_test_clobber_v10_upper
  501. .align 4
  502. abi_test_clobber_v10_upper:
  503. AARCH64_VALID_CALL_TARGET
  504. fmov v10.d[1], xzr
  505. ret
  506. .globl abi_test_clobber_v11_upper
  507. .align 4
  508. abi_test_clobber_v11_upper:
  509. AARCH64_VALID_CALL_TARGET
  510. fmov v11.d[1], xzr
  511. ret
  512. .globl abi_test_clobber_v12_upper
  513. .align 4
  514. abi_test_clobber_v12_upper:
  515. AARCH64_VALID_CALL_TARGET
  516. fmov v12.d[1], xzr
  517. ret
  518. .globl abi_test_clobber_v13_upper
  519. .align 4
  520. abi_test_clobber_v13_upper:
  521. AARCH64_VALID_CALL_TARGET
  522. fmov v13.d[1], xzr
  523. ret
  524. .globl abi_test_clobber_v14_upper
  525. .align 4
  526. abi_test_clobber_v14_upper:
  527. AARCH64_VALID_CALL_TARGET
  528. fmov v14.d[1], xzr
  529. ret
  530. .globl abi_test_clobber_v15_upper
  531. .align 4
  532. abi_test_clobber_v15_upper:
  533. AARCH64_VALID_CALL_TARGET
  534. fmov v15.d[1], xzr
  535. ret
  536. #endif
  537. #endif // !OPENSSL_NO_ASM