trampoline-x86_64.asm 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. ; This file is generated from a similarly-named Perl script in the BoringSSL
  2. ; source tree. Do not edit by hand.
  3. default rel
  4. %define XMMWORD
  5. %define YMMWORD
  6. %define ZMMWORD
  7. %ifdef BORINGSSL_PREFIX
  8. %include "boringssl_prefix_symbols_nasm.inc"
  9. %endif
  10. section .text code align=64
  11. global abi_test_trampoline
  12. ALIGN 16
  13. abi_test_trampoline:
  14. $L$abi_test_trampoline_seh_begin:
  15. sub rsp,344
  16. $L$abi_test_trampoline_seh_prolog_alloc:
  17. mov QWORD[112+rsp],rbx
  18. $L$abi_test_trampoline_seh_prolog_rbx:
  19. mov QWORD[120+rsp],rbp
  20. $L$abi_test_trampoline_seh_prolog_rbp:
  21. mov QWORD[128+rsp],rdi
  22. $L$abi_test_trampoline_seh_prolog_rdi:
  23. mov QWORD[136+rsp],rsi
  24. $L$abi_test_trampoline_seh_prolog_rsi:
  25. mov QWORD[144+rsp],r12
  26. $L$abi_test_trampoline_seh_prolog_r12:
  27. mov QWORD[152+rsp],r13
  28. $L$abi_test_trampoline_seh_prolog_r13:
  29. mov QWORD[160+rsp],r14
  30. $L$abi_test_trampoline_seh_prolog_r14:
  31. mov QWORD[168+rsp],r15
  32. $L$abi_test_trampoline_seh_prolog_r15:
  33. movdqa XMMWORD[176+rsp],xmm6
  34. $L$abi_test_trampoline_seh_prolog_xmm6:
  35. movdqa XMMWORD[192+rsp],xmm7
  36. $L$abi_test_trampoline_seh_prolog_xmm7:
  37. movdqa XMMWORD[208+rsp],xmm8
  38. $L$abi_test_trampoline_seh_prolog_xmm8:
  39. movdqa XMMWORD[224+rsp],xmm9
  40. $L$abi_test_trampoline_seh_prolog_xmm9:
  41. movdqa XMMWORD[240+rsp],xmm10
  42. $L$abi_test_trampoline_seh_prolog_xmm10:
  43. movdqa XMMWORD[256+rsp],xmm11
  44. $L$abi_test_trampoline_seh_prolog_xmm11:
  45. movdqa XMMWORD[272+rsp],xmm12
  46. $L$abi_test_trampoline_seh_prolog_xmm12:
  47. movdqa XMMWORD[288+rsp],xmm13
  48. $L$abi_test_trampoline_seh_prolog_xmm13:
  49. movdqa XMMWORD[304+rsp],xmm14
  50. $L$abi_test_trampoline_seh_prolog_xmm14:
  51. movdqa XMMWORD[320+rsp],xmm15
  52. $L$abi_test_trampoline_seh_prolog_xmm15:
  53. $L$abi_test_trampoline_seh_prolog_end:
  54. mov rbx,QWORD[rdx]
  55. mov rbp,QWORD[8+rdx]
  56. mov rdi,QWORD[16+rdx]
  57. mov rsi,QWORD[24+rdx]
  58. mov r12,QWORD[32+rdx]
  59. mov r13,QWORD[40+rdx]
  60. mov r14,QWORD[48+rdx]
  61. mov r15,QWORD[56+rdx]
  62. movdqa xmm6,XMMWORD[64+rdx]
  63. movdqa xmm7,XMMWORD[80+rdx]
  64. movdqa xmm8,XMMWORD[96+rdx]
  65. movdqa xmm9,XMMWORD[112+rdx]
  66. movdqa xmm10,XMMWORD[128+rdx]
  67. movdqa xmm11,XMMWORD[144+rdx]
  68. movdqa xmm12,XMMWORD[160+rdx]
  69. movdqa xmm13,XMMWORD[176+rdx]
  70. movdqa xmm14,XMMWORD[192+rdx]
  71. movdqa xmm15,XMMWORD[208+rdx]
  72. mov QWORD[88+rsp],rcx
  73. mov QWORD[96+rsp],rdx
  74. mov r10,r8
  75. mov r11,r9
  76. dec r11
  77. js NEAR $L$args_done
  78. mov rcx,QWORD[r10]
  79. add r10,8
  80. dec r11
  81. js NEAR $L$args_done
  82. mov rdx,QWORD[r10]
  83. add r10,8
  84. dec r11
  85. js NEAR $L$args_done
  86. mov r8,QWORD[r10]
  87. add r10,8
  88. dec r11
  89. js NEAR $L$args_done
  90. mov r9,QWORD[r10]
  91. add r10,8
  92. lea rax,[32+rsp]
  93. $L$args_loop:
  94. dec r11
  95. js NEAR $L$args_done
  96. mov QWORD[104+rsp],r11
  97. mov r11,QWORD[r10]
  98. mov QWORD[rax],r11
  99. mov r11,QWORD[104+rsp]
  100. add r10,8
  101. add rax,8
  102. jmp NEAR $L$args_loop
  103. $L$args_done:
  104. mov rax,QWORD[88+rsp]
  105. mov r10,QWORD[384+rsp]
  106. test r10,r10
  107. jz NEAR $L$no_unwind
  108. pushfq
  109. or QWORD[rsp],0x100
  110. popfq
  111. nop
  112. global abi_test_unwind_start
  113. abi_test_unwind_start:
  114. call rax
  115. global abi_test_unwind_return
  116. abi_test_unwind_return:
  117. pushfq
  118. and QWORD[rsp],-0x101
  119. popfq
  120. global abi_test_unwind_stop
  121. abi_test_unwind_stop:
  122. jmp NEAR $L$call_done
  123. $L$no_unwind:
  124. call rax
  125. $L$call_done:
  126. mov rdx,QWORD[96+rsp]
  127. mov QWORD[rdx],rbx
  128. mov QWORD[8+rdx],rbp
  129. mov QWORD[16+rdx],rdi
  130. mov QWORD[24+rdx],rsi
  131. mov QWORD[32+rdx],r12
  132. mov QWORD[40+rdx],r13
  133. mov QWORD[48+rdx],r14
  134. mov QWORD[56+rdx],r15
  135. movdqa XMMWORD[64+rdx],xmm6
  136. movdqa XMMWORD[80+rdx],xmm7
  137. movdqa XMMWORD[96+rdx],xmm8
  138. movdqa XMMWORD[112+rdx],xmm9
  139. movdqa XMMWORD[128+rdx],xmm10
  140. movdqa XMMWORD[144+rdx],xmm11
  141. movdqa XMMWORD[160+rdx],xmm12
  142. movdqa XMMWORD[176+rdx],xmm13
  143. movdqa XMMWORD[192+rdx],xmm14
  144. movdqa XMMWORD[208+rdx],xmm15
  145. mov rbx,QWORD[112+rsp]
  146. mov rbp,QWORD[120+rsp]
  147. mov rdi,QWORD[128+rsp]
  148. mov rsi,QWORD[136+rsp]
  149. mov r12,QWORD[144+rsp]
  150. mov r13,QWORD[152+rsp]
  151. mov r14,QWORD[160+rsp]
  152. mov r15,QWORD[168+rsp]
  153. movdqa xmm6,XMMWORD[176+rsp]
  154. movdqa xmm7,XMMWORD[192+rsp]
  155. movdqa xmm8,XMMWORD[208+rsp]
  156. movdqa xmm9,XMMWORD[224+rsp]
  157. movdqa xmm10,XMMWORD[240+rsp]
  158. movdqa xmm11,XMMWORD[256+rsp]
  159. movdqa xmm12,XMMWORD[272+rsp]
  160. movdqa xmm13,XMMWORD[288+rsp]
  161. movdqa xmm14,XMMWORD[304+rsp]
  162. movdqa xmm15,XMMWORD[320+rsp]
  163. add rsp,344
  164. DB 0F3h,0C3h ;repret
  165. $L$abi_test_trampoline_seh_end:
  166. global abi_test_clobber_rax
  167. ALIGN 16
  168. abi_test_clobber_rax:
  169. xor rax,rax
  170. DB 0F3h,0C3h ;repret
  171. global abi_test_clobber_rbx
  172. ALIGN 16
  173. abi_test_clobber_rbx:
  174. xor rbx,rbx
  175. DB 0F3h,0C3h ;repret
  176. global abi_test_clobber_rcx
  177. ALIGN 16
  178. abi_test_clobber_rcx:
  179. xor rcx,rcx
  180. DB 0F3h,0C3h ;repret
  181. global abi_test_clobber_rdx
  182. ALIGN 16
  183. abi_test_clobber_rdx:
  184. xor rdx,rdx
  185. DB 0F3h,0C3h ;repret
  186. global abi_test_clobber_rdi
  187. ALIGN 16
  188. abi_test_clobber_rdi:
  189. xor rdi,rdi
  190. DB 0F3h,0C3h ;repret
  191. global abi_test_clobber_rsi
  192. ALIGN 16
  193. abi_test_clobber_rsi:
  194. xor rsi,rsi
  195. DB 0F3h,0C3h ;repret
  196. global abi_test_clobber_rbp
  197. ALIGN 16
  198. abi_test_clobber_rbp:
  199. xor rbp,rbp
  200. DB 0F3h,0C3h ;repret
  201. global abi_test_clobber_r8
  202. ALIGN 16
  203. abi_test_clobber_r8:
  204. xor r8,r8
  205. DB 0F3h,0C3h ;repret
  206. global abi_test_clobber_r9
  207. ALIGN 16
  208. abi_test_clobber_r9:
  209. xor r9,r9
  210. DB 0F3h,0C3h ;repret
  211. global abi_test_clobber_r10
  212. ALIGN 16
  213. abi_test_clobber_r10:
  214. xor r10,r10
  215. DB 0F3h,0C3h ;repret
  216. global abi_test_clobber_r11
  217. ALIGN 16
  218. abi_test_clobber_r11:
  219. xor r11,r11
  220. DB 0F3h,0C3h ;repret
  221. global abi_test_clobber_r12
  222. ALIGN 16
  223. abi_test_clobber_r12:
  224. xor r12,r12
  225. DB 0F3h,0C3h ;repret
  226. global abi_test_clobber_r13
  227. ALIGN 16
  228. abi_test_clobber_r13:
  229. xor r13,r13
  230. DB 0F3h,0C3h ;repret
  231. global abi_test_clobber_r14
  232. ALIGN 16
  233. abi_test_clobber_r14:
  234. xor r14,r14
  235. DB 0F3h,0C3h ;repret
  236. global abi_test_clobber_r15
  237. ALIGN 16
  238. abi_test_clobber_r15:
  239. xor r15,r15
  240. DB 0F3h,0C3h ;repret
  241. global abi_test_clobber_xmm0
  242. ALIGN 16
  243. abi_test_clobber_xmm0:
  244. pxor xmm0,xmm0
  245. DB 0F3h,0C3h ;repret
  246. global abi_test_clobber_xmm1
  247. ALIGN 16
  248. abi_test_clobber_xmm1:
  249. pxor xmm1,xmm1
  250. DB 0F3h,0C3h ;repret
  251. global abi_test_clobber_xmm2
  252. ALIGN 16
  253. abi_test_clobber_xmm2:
  254. pxor xmm2,xmm2
  255. DB 0F3h,0C3h ;repret
  256. global abi_test_clobber_xmm3
  257. ALIGN 16
  258. abi_test_clobber_xmm3:
  259. pxor xmm3,xmm3
  260. DB 0F3h,0C3h ;repret
  261. global abi_test_clobber_xmm4
  262. ALIGN 16
  263. abi_test_clobber_xmm4:
  264. pxor xmm4,xmm4
  265. DB 0F3h,0C3h ;repret
  266. global abi_test_clobber_xmm5
  267. ALIGN 16
  268. abi_test_clobber_xmm5:
  269. pxor xmm5,xmm5
  270. DB 0F3h,0C3h ;repret
  271. global abi_test_clobber_xmm6
  272. ALIGN 16
  273. abi_test_clobber_xmm6:
  274. pxor xmm6,xmm6
  275. DB 0F3h,0C3h ;repret
  276. global abi_test_clobber_xmm7
  277. ALIGN 16
  278. abi_test_clobber_xmm7:
  279. pxor xmm7,xmm7
  280. DB 0F3h,0C3h ;repret
  281. global abi_test_clobber_xmm8
  282. ALIGN 16
  283. abi_test_clobber_xmm8:
  284. pxor xmm8,xmm8
  285. DB 0F3h,0C3h ;repret
  286. global abi_test_clobber_xmm9
  287. ALIGN 16
  288. abi_test_clobber_xmm9:
  289. pxor xmm9,xmm9
  290. DB 0F3h,0C3h ;repret
  291. global abi_test_clobber_xmm10
  292. ALIGN 16
  293. abi_test_clobber_xmm10:
  294. pxor xmm10,xmm10
  295. DB 0F3h,0C3h ;repret
  296. global abi_test_clobber_xmm11
  297. ALIGN 16
  298. abi_test_clobber_xmm11:
  299. pxor xmm11,xmm11
  300. DB 0F3h,0C3h ;repret
  301. global abi_test_clobber_xmm12
  302. ALIGN 16
  303. abi_test_clobber_xmm12:
  304. pxor xmm12,xmm12
  305. DB 0F3h,0C3h ;repret
  306. global abi_test_clobber_xmm13
  307. ALIGN 16
  308. abi_test_clobber_xmm13:
  309. pxor xmm13,xmm13
  310. DB 0F3h,0C3h ;repret
  311. global abi_test_clobber_xmm14
  312. ALIGN 16
  313. abi_test_clobber_xmm14:
  314. pxor xmm14,xmm14
  315. DB 0F3h,0C3h ;repret
  316. global abi_test_clobber_xmm15
  317. ALIGN 16
  318. abi_test_clobber_xmm15:
  319. pxor xmm15,xmm15
  320. DB 0F3h,0C3h ;repret
  321. global abi_test_bad_unwind_wrong_register
  322. ALIGN 16
  323. abi_test_bad_unwind_wrong_register:
  324. $L$abi_test_bad_unwind_wrong_register_seh_begin:
  325. push r12
  326. $L$abi_test_bad_unwind_wrong_register_seh_push_r13:
  327. nop
  328. pop r12
  329. DB 0F3h,0C3h ;repret
  330. $L$abi_test_bad_unwind_wrong_register_seh_end:
  331. global abi_test_bad_unwind_temporary
  332. ALIGN 16
  333. abi_test_bad_unwind_temporary:
  334. $L$abi_test_bad_unwind_temporary_seh_begin:
  335. push r12
  336. $L$abi_test_bad_unwind_temporary_seh_push_r12:
  337. mov rax,r12
  338. inc rax
  339. mov QWORD[rsp],rax
  340. mov QWORD[rsp],r12
  341. pop r12
  342. DB 0F3h,0C3h ;repret
  343. $L$abi_test_bad_unwind_temporary_seh_end:
  344. global abi_test_get_and_clear_direction_flag
  345. abi_test_get_and_clear_direction_flag:
  346. pushfq
  347. pop rax
  348. and rax,0x400
  349. shr rax,10
  350. cld
  351. DB 0F3h,0C3h ;repret
  352. global abi_test_set_direction_flag
  353. abi_test_set_direction_flag:
  354. std
  355. DB 0F3h,0C3h ;repret
  356. global abi_test_bad_unwind_epilog
  357. ALIGN 16
  358. abi_test_bad_unwind_epilog:
  359. $L$abi_test_bad_unwind_epilog_seh_begin:
  360. push r12
  361. $L$abi_test_bad_unwind_epilog_seh_push_r12:
  362. nop
  363. pop r12
  364. nop
  365. DB 0F3h,0C3h ;repret
  366. $L$abi_test_bad_unwind_epilog_seh_end:
  367. section .pdata rdata align=4
  368. ALIGN 4
  369. DD $L$abi_test_trampoline_seh_begin wrt ..imagebase
  370. DD $L$abi_test_trampoline_seh_end wrt ..imagebase
  371. DD $L$abi_test_trampoline_seh_info wrt ..imagebase
  372. DD $L$abi_test_bad_unwind_wrong_register_seh_begin wrt ..imagebase
  373. DD $L$abi_test_bad_unwind_wrong_register_seh_end wrt ..imagebase
  374. DD $L$abi_test_bad_unwind_wrong_register_seh_info wrt ..imagebase
  375. DD $L$abi_test_bad_unwind_temporary_seh_begin wrt ..imagebase
  376. DD $L$abi_test_bad_unwind_temporary_seh_end wrt ..imagebase
  377. DD $L$abi_test_bad_unwind_temporary_seh_info wrt ..imagebase
  378. DD $L$abi_test_bad_unwind_epilog_seh_begin wrt ..imagebase
  379. DD $L$abi_test_bad_unwind_epilog_seh_end wrt ..imagebase
  380. DD $L$abi_test_bad_unwind_epilog_seh_info wrt ..imagebase
  381. section .xdata rdata align=8
  382. ALIGN 8
  383. $L$abi_test_trampoline_seh_info:
  384. DB 1
  385. DB $L$abi_test_trampoline_seh_prolog_end-$L$abi_test_trampoline_seh_begin
  386. DB 38
  387. DB 0
  388. DB $L$abi_test_trampoline_seh_prolog_xmm15-$L$abi_test_trampoline_seh_begin
  389. DB 248
  390. DW 20
  391. DB $L$abi_test_trampoline_seh_prolog_xmm14-$L$abi_test_trampoline_seh_begin
  392. DB 232
  393. DW 19
  394. DB $L$abi_test_trampoline_seh_prolog_xmm13-$L$abi_test_trampoline_seh_begin
  395. DB 216
  396. DW 18
  397. DB $L$abi_test_trampoline_seh_prolog_xmm12-$L$abi_test_trampoline_seh_begin
  398. DB 200
  399. DW 17
  400. DB $L$abi_test_trampoline_seh_prolog_xmm11-$L$abi_test_trampoline_seh_begin
  401. DB 184
  402. DW 16
  403. DB $L$abi_test_trampoline_seh_prolog_xmm10-$L$abi_test_trampoline_seh_begin
  404. DB 168
  405. DW 15
  406. DB $L$abi_test_trampoline_seh_prolog_xmm9-$L$abi_test_trampoline_seh_begin
  407. DB 152
  408. DW 14
  409. DB $L$abi_test_trampoline_seh_prolog_xmm8-$L$abi_test_trampoline_seh_begin
  410. DB 136
  411. DW 13
  412. DB $L$abi_test_trampoline_seh_prolog_xmm7-$L$abi_test_trampoline_seh_begin
  413. DB 120
  414. DW 12
  415. DB $L$abi_test_trampoline_seh_prolog_xmm6-$L$abi_test_trampoline_seh_begin
  416. DB 104
  417. DW 11
  418. DB $L$abi_test_trampoline_seh_prolog_r15-$L$abi_test_trampoline_seh_begin
  419. DB 244
  420. DW 21
  421. DB $L$abi_test_trampoline_seh_prolog_r14-$L$abi_test_trampoline_seh_begin
  422. DB 228
  423. DW 20
  424. DB $L$abi_test_trampoline_seh_prolog_r13-$L$abi_test_trampoline_seh_begin
  425. DB 212
  426. DW 19
  427. DB $L$abi_test_trampoline_seh_prolog_r12-$L$abi_test_trampoline_seh_begin
  428. DB 196
  429. DW 18
  430. DB $L$abi_test_trampoline_seh_prolog_rsi-$L$abi_test_trampoline_seh_begin
  431. DB 100
  432. DW 17
  433. DB $L$abi_test_trampoline_seh_prolog_rdi-$L$abi_test_trampoline_seh_begin
  434. DB 116
  435. DW 16
  436. DB $L$abi_test_trampoline_seh_prolog_rbp-$L$abi_test_trampoline_seh_begin
  437. DB 84
  438. DW 15
  439. DB $L$abi_test_trampoline_seh_prolog_rbx-$L$abi_test_trampoline_seh_begin
  440. DB 52
  441. DW 14
  442. DB $L$abi_test_trampoline_seh_prolog_alloc-$L$abi_test_trampoline_seh_begin
  443. DB 1
  444. DW 43
  445. ALIGN 8
  446. $L$abi_test_bad_unwind_wrong_register_seh_info:
  447. DB 1
  448. DB $L$abi_test_bad_unwind_wrong_register_seh_push_r13-$L$abi_test_bad_unwind_wrong_register_seh_begin
  449. DB 1
  450. DB 0
  451. DB $L$abi_test_bad_unwind_wrong_register_seh_push_r13-$L$abi_test_bad_unwind_wrong_register_seh_begin
  452. DB 208
  453. ALIGN 8
  454. $L$abi_test_bad_unwind_temporary_seh_info:
  455. DB 1
  456. DB $L$abi_test_bad_unwind_temporary_seh_push_r12-$L$abi_test_bad_unwind_temporary_seh_begin
  457. DB 1
  458. DB 0
  459. DB $L$abi_test_bad_unwind_temporary_seh_push_r12-$L$abi_test_bad_unwind_temporary_seh_begin
  460. DB 192
  461. ALIGN 8
  462. $L$abi_test_bad_unwind_epilog_seh_info:
  463. DB 1
  464. DB $L$abi_test_bad_unwind_epilog_seh_push_r12-$L$abi_test_bad_unwind_epilog_seh_begin
  465. DB 1
  466. DB 0
  467. DB $L$abi_test_bad_unwind_epilog_seh_push_r12-$L$abi_test_bad_unwind_epilog_seh_begin
  468. DB 192