1// This file is generated from a similarly-named Perl script in the BoringSSL 2// source tree. Do not edit by hand. 3 4#if !defined(__has_feature) 5#define __has_feature(x) 0 6#endif 7#if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM) 8#define OPENSSL_NO_ASM 9#endif 10 11#if !defined(OPENSSL_NO_ASM) 12#if defined(__aarch64__) 13#if defined(BORINGSSL_PREFIX) 14#include <boringssl_prefix_symbols_asm.h> 15#endif 16#include <openssl/arm_arch.h> 17 18.text 19 20// abi_test_trampoline loads callee-saved registers from |state|, calls |func| 21// with |argv|, then saves the callee-saved registers into |state|. It returns 22// the result of |func|. The |unwind| argument is unused. 23// uint64_t abi_test_trampoline(void (*func)(...), CallerState *state, 24// const uint64_t *argv, size_t argc, 25// uint64_t unwind); 26 27.globl abi_test_trampoline 28 29.align 4 30abi_test_trampoline: 31Labi_test_trampoline_begin: 32 AARCH64_SIGN_LINK_REGISTER 33 // Stack layout (low to high addresses) 34 // x29,x30 (16 bytes) 35 // d8-d15 (64 bytes) 36 // x19-x28 (80 bytes) 37 // x1 (8 bytes) 38 // padding (8 bytes) 39 stp x29, x30, [sp, #-176]! 40 mov x29, sp 41 42 // Saved callee-saved registers and |state|. 43 stp d8, d9, [sp, #16] 44 stp d10, d11, [sp, #32] 45 stp d12, d13, [sp, #48] 46 stp d14, d15, [sp, #64] 47 stp x19, x20, [sp, #80] 48 stp x21, x22, [sp, #96] 49 stp x23, x24, [sp, #112] 50 stp x25, x26, [sp, #128] 51 stp x27, x28, [sp, #144] 52 str x1, [sp, #160] 53 54 // Load registers from |state|, with the exception of x29. x29 is the 55 // frame pointer and also callee-saved, but AAPCS64 allows platforms to 56 // mandate that x29 always point to a frame. iOS64 does so, which means 57 // we cannot fill x29 with entropy without violating ABI rules 58 // ourselves. x29 is tested separately below. 59 ldp d8, d9, [x1], #16 60 ldp d10, d11, [x1], #16 61 ldp d12, d13, [x1], #16 62 ldp d14, d15, [x1], #16 63 ldp x19, x20, [x1], #16 64 ldp x21, x22, [x1], #16 65 ldp x23, x24, [x1], #16 66 ldp x25, x26, [x1], #16 67 ldp x27, x28, [x1], #16 68 69 // Move parameters into temporary registers. 70 mov x9, x0 71 mov x10, x2 72 mov x11, x3 73 74 // Load parameters into registers. 75 cbz x11, Largs_done 76 ldr x0, [x10], #8 77 subs x11, x11, #1 78 b.eq Largs_done 79 ldr x1, [x10], #8 80 subs x11, x11, #1 81 b.eq Largs_done 82 ldr x2, [x10], #8 83 subs x11, x11, #1 84 b.eq Largs_done 85 ldr x3, [x10], #8 86 subs x11, x11, #1 87 b.eq Largs_done 88 ldr x4, [x10], #8 89 subs x11, x11, #1 90 b.eq Largs_done 91 ldr x5, [x10], #8 92 subs x11, x11, #1 93 b.eq Largs_done 94 ldr x6, [x10], #8 95 subs x11, x11, #1 96 b.eq Largs_done 97 ldr x7, [x10], #8 98 99Largs_done: 100 blr x9 101 102 // Reload |state| and store registers. 103 ldr x1, [sp, #160] 104 stp d8, d9, [x1], #16 105 stp d10, d11, [x1], #16 106 stp d12, d13, [x1], #16 107 stp d14, d15, [x1], #16 108 stp x19, x20, [x1], #16 109 stp x21, x22, [x1], #16 110 stp x23, x24, [x1], #16 111 stp x25, x26, [x1], #16 112 stp x27, x28, [x1], #16 113 114 // |func| is required to preserve x29, the frame pointer. We cannot load 115 // random values into x29 (see comment above), so compare it against the 116 // expected value and zero the field of |state| if corrupted. 117 mov x9, sp 118 cmp x29, x9 119 b.eq Lx29_ok 120 str xzr, [x1] 121 122Lx29_ok: 123 // Restore callee-saved registers. 124 ldp d8, d9, [sp, #16] 125 ldp d10, d11, [sp, #32] 126 ldp d12, d13, [sp, #48] 127 ldp d14, d15, [sp, #64] 128 ldp x19, x20, [sp, #80] 129 ldp x21, x22, [sp, #96] 130 ldp x23, x24, [sp, #112] 131 ldp x25, x26, [sp, #128] 132 ldp x27, x28, [sp, #144] 133 134 ldp x29, x30, [sp], #176 135 AARCH64_VALIDATE_LINK_REGISTER 136 ret 137 138 139.globl abi_test_clobber_x0 140 141.align 4 142abi_test_clobber_x0: 143 AARCH64_VALID_CALL_TARGET 144 mov x0, xzr 145 ret 146 147 148.globl abi_test_clobber_x1 149 150.align 4 151abi_test_clobber_x1: 152 AARCH64_VALID_CALL_TARGET 153 mov x1, xzr 154 ret 155 156 157.globl abi_test_clobber_x2 158 159.align 4 160abi_test_clobber_x2: 161 AARCH64_VALID_CALL_TARGET 162 mov x2, xzr 163 ret 164 165 166.globl abi_test_clobber_x3 167 168.align 4 169abi_test_clobber_x3: 170 AARCH64_VALID_CALL_TARGET 171 mov x3, xzr 172 ret 173 174 175.globl abi_test_clobber_x4 176 177.align 4 178abi_test_clobber_x4: 179 AARCH64_VALID_CALL_TARGET 180 mov x4, xzr 181 ret 182 183 184.globl abi_test_clobber_x5 185 186.align 4 187abi_test_clobber_x5: 188 AARCH64_VALID_CALL_TARGET 189 mov x5, xzr 190 ret 191 192 193.globl abi_test_clobber_x6 194 195.align 4 196abi_test_clobber_x6: 197 AARCH64_VALID_CALL_TARGET 198 mov x6, xzr 199 ret 200 201 202.globl abi_test_clobber_x7 203 204.align 4 205abi_test_clobber_x7: 206 AARCH64_VALID_CALL_TARGET 207 mov x7, xzr 208 ret 209 210 211.globl abi_test_clobber_x8 212 213.align 4 214abi_test_clobber_x8: 215 AARCH64_VALID_CALL_TARGET 216 mov x8, xzr 217 ret 218 219 220.globl abi_test_clobber_x9 221 222.align 4 223abi_test_clobber_x9: 224 AARCH64_VALID_CALL_TARGET 225 mov x9, xzr 226 ret 227 228 229.globl abi_test_clobber_x10 230 231.align 4 232abi_test_clobber_x10: 233 AARCH64_VALID_CALL_TARGET 234 mov x10, xzr 235 ret 236 237 238.globl abi_test_clobber_x11 239 240.align 4 241abi_test_clobber_x11: 242 AARCH64_VALID_CALL_TARGET 243 mov x11, xzr 244 ret 245 246 247.globl abi_test_clobber_x12 248 249.align 4 250abi_test_clobber_x12: 251 AARCH64_VALID_CALL_TARGET 252 mov x12, xzr 253 ret 254 255 256.globl abi_test_clobber_x13 257 258.align 4 259abi_test_clobber_x13: 260 AARCH64_VALID_CALL_TARGET 261 mov x13, xzr 262 ret 263 264 265.globl abi_test_clobber_x14 266 267.align 4 268abi_test_clobber_x14: 269 AARCH64_VALID_CALL_TARGET 270 mov x14, xzr 271 ret 272 273 274.globl abi_test_clobber_x15 275 276.align 4 277abi_test_clobber_x15: 278 AARCH64_VALID_CALL_TARGET 279 mov x15, xzr 280 ret 281 282 283.globl abi_test_clobber_x16 284 285.align 4 286abi_test_clobber_x16: 287 AARCH64_VALID_CALL_TARGET 288 mov x16, xzr 289 ret 290 291 292.globl abi_test_clobber_x17 293 294.align 4 295abi_test_clobber_x17: 296 AARCH64_VALID_CALL_TARGET 297 mov x17, xzr 298 ret 299 300 301.globl abi_test_clobber_x19 302 303.align 4 304abi_test_clobber_x19: 305 AARCH64_VALID_CALL_TARGET 306 mov x19, xzr 307 ret 308 309 310.globl abi_test_clobber_x20 311 312.align 4 313abi_test_clobber_x20: 314 AARCH64_VALID_CALL_TARGET 315 mov x20, xzr 316 ret 317 318 319.globl abi_test_clobber_x21 320 321.align 4 322abi_test_clobber_x21: 323 AARCH64_VALID_CALL_TARGET 324 mov x21, xzr 325 ret 326 327 328.globl abi_test_clobber_x22 329 330.align 4 331abi_test_clobber_x22: 332 AARCH64_VALID_CALL_TARGET 333 mov x22, xzr 334 ret 335 336 337.globl abi_test_clobber_x23 338 339.align 4 340abi_test_clobber_x23: 341 AARCH64_VALID_CALL_TARGET 342 mov x23, xzr 343 ret 344 345 346.globl abi_test_clobber_x24 347 348.align 4 349abi_test_clobber_x24: 350 AARCH64_VALID_CALL_TARGET 351 mov x24, xzr 352 ret 353 354 355.globl abi_test_clobber_x25 356 357.align 4 358abi_test_clobber_x25: 359 AARCH64_VALID_CALL_TARGET 360 mov x25, xzr 361 ret 362 363 364.globl abi_test_clobber_x26 365 366.align 4 367abi_test_clobber_x26: 368 AARCH64_VALID_CALL_TARGET 369 mov x26, xzr 370 ret 371 372 373.globl abi_test_clobber_x27 374 375.align 4 376abi_test_clobber_x27: 377 AARCH64_VALID_CALL_TARGET 378 mov x27, xzr 379 ret 380 381 382.globl abi_test_clobber_x28 383 384.align 4 385abi_test_clobber_x28: 386 AARCH64_VALID_CALL_TARGET 387 mov x28, xzr 388 ret 389 390 391.globl abi_test_clobber_x29 392 393.align 4 394abi_test_clobber_x29: 395 AARCH64_VALID_CALL_TARGET 396 mov x29, xzr 397 ret 398 399 400.globl abi_test_clobber_d0 401 402.align 4 403abi_test_clobber_d0: 404 AARCH64_VALID_CALL_TARGET 405 fmov d0, xzr 406 ret 407 408 409.globl abi_test_clobber_d1 410 411.align 4 412abi_test_clobber_d1: 413 AARCH64_VALID_CALL_TARGET 414 fmov d1, xzr 415 ret 416 417 418.globl abi_test_clobber_d2 419 420.align 4 421abi_test_clobber_d2: 422 AARCH64_VALID_CALL_TARGET 423 fmov d2, xzr 424 ret 425 426 427.globl abi_test_clobber_d3 428 429.align 4 430abi_test_clobber_d3: 431 AARCH64_VALID_CALL_TARGET 432 fmov d3, xzr 433 ret 434 435 436.globl abi_test_clobber_d4 437 438.align 4 439abi_test_clobber_d4: 440 AARCH64_VALID_CALL_TARGET 441 fmov d4, xzr 442 ret 443 444 445.globl abi_test_clobber_d5 446 447.align 4 448abi_test_clobber_d5: 449 AARCH64_VALID_CALL_TARGET 450 fmov d5, xzr 451 ret 452 453 454.globl abi_test_clobber_d6 455 456.align 4 457abi_test_clobber_d6: 458 AARCH64_VALID_CALL_TARGET 459 fmov d6, xzr 460 ret 461 462 463.globl abi_test_clobber_d7 464 465.align 4 466abi_test_clobber_d7: 467 AARCH64_VALID_CALL_TARGET 468 fmov d7, xzr 469 ret 470 471 472.globl abi_test_clobber_d8 473 474.align 4 475abi_test_clobber_d8: 476 AARCH64_VALID_CALL_TARGET 477 fmov d8, xzr 478 ret 479 480 481.globl abi_test_clobber_d9 482 483.align 4 484abi_test_clobber_d9: 485 AARCH64_VALID_CALL_TARGET 486 fmov d9, xzr 487 ret 488 489 490.globl abi_test_clobber_d10 491 492.align 4 493abi_test_clobber_d10: 494 AARCH64_VALID_CALL_TARGET 495 fmov d10, xzr 496 ret 497 498 499.globl abi_test_clobber_d11 500 501.align 4 502abi_test_clobber_d11: 503 AARCH64_VALID_CALL_TARGET 504 fmov d11, xzr 505 ret 506 507 508.globl abi_test_clobber_d12 509 510.align 4 511abi_test_clobber_d12: 512 AARCH64_VALID_CALL_TARGET 513 fmov d12, xzr 514 ret 515 516 517.globl abi_test_clobber_d13 518 519.align 4 520abi_test_clobber_d13: 521 AARCH64_VALID_CALL_TARGET 522 fmov d13, xzr 523 ret 524 525 526.globl abi_test_clobber_d14 527 528.align 4 529abi_test_clobber_d14: 530 AARCH64_VALID_CALL_TARGET 531 fmov d14, xzr 532 ret 533 534 535.globl abi_test_clobber_d15 536 537.align 4 538abi_test_clobber_d15: 539 AARCH64_VALID_CALL_TARGET 540 fmov d15, xzr 541 ret 542 543 544.globl abi_test_clobber_d16 545 546.align 4 547abi_test_clobber_d16: 548 AARCH64_VALID_CALL_TARGET 549 fmov d16, xzr 550 ret 551 552 553.globl abi_test_clobber_d17 554 555.align 4 556abi_test_clobber_d17: 557 AARCH64_VALID_CALL_TARGET 558 fmov d17, xzr 559 ret 560 561 562.globl abi_test_clobber_d18 563 564.align 4 565abi_test_clobber_d18: 566 AARCH64_VALID_CALL_TARGET 567 fmov d18, xzr 568 ret 569 570 571.globl abi_test_clobber_d19 572 573.align 4 574abi_test_clobber_d19: 575 AARCH64_VALID_CALL_TARGET 576 fmov d19, xzr 577 ret 578 579 580.globl abi_test_clobber_d20 581 582.align 4 583abi_test_clobber_d20: 584 AARCH64_VALID_CALL_TARGET 585 fmov d20, xzr 586 ret 587 588 589.globl abi_test_clobber_d21 590 591.align 4 592abi_test_clobber_d21: 593 AARCH64_VALID_CALL_TARGET 594 fmov d21, xzr 595 ret 596 597 598.globl abi_test_clobber_d22 599 600.align 4 601abi_test_clobber_d22: 602 AARCH64_VALID_CALL_TARGET 603 fmov d22, xzr 604 ret 605 606 607.globl abi_test_clobber_d23 608 609.align 4 610abi_test_clobber_d23: 611 AARCH64_VALID_CALL_TARGET 612 fmov d23, xzr 613 ret 614 615 616.globl abi_test_clobber_d24 617 618.align 4 619abi_test_clobber_d24: 620 AARCH64_VALID_CALL_TARGET 621 fmov d24, xzr 622 ret 623 624 625.globl abi_test_clobber_d25 626 627.align 4 628abi_test_clobber_d25: 629 AARCH64_VALID_CALL_TARGET 630 fmov d25, xzr 631 ret 632 633 634.globl abi_test_clobber_d26 635 636.align 4 637abi_test_clobber_d26: 638 AARCH64_VALID_CALL_TARGET 639 fmov d26, xzr 640 ret 641 642 643.globl abi_test_clobber_d27 644 645.align 4 646abi_test_clobber_d27: 647 AARCH64_VALID_CALL_TARGET 648 fmov d27, xzr 649 ret 650 651 652.globl abi_test_clobber_d28 653 654.align 4 655abi_test_clobber_d28: 656 AARCH64_VALID_CALL_TARGET 657 fmov d28, xzr 658 ret 659 660 661.globl abi_test_clobber_d29 662 663.align 4 664abi_test_clobber_d29: 665 AARCH64_VALID_CALL_TARGET 666 fmov d29, xzr 667 ret 668 669 670.globl abi_test_clobber_d30 671 672.align 4 673abi_test_clobber_d30: 674 AARCH64_VALID_CALL_TARGET 675 fmov d30, xzr 676 ret 677 678 679.globl abi_test_clobber_d31 680 681.align 4 682abi_test_clobber_d31: 683 AARCH64_VALID_CALL_TARGET 684 fmov d31, xzr 685 ret 686 687 688.globl abi_test_clobber_v8_upper 689 690.align 4 691abi_test_clobber_v8_upper: 692 AARCH64_VALID_CALL_TARGET 693 fmov v8.d[1], xzr 694 ret 695 696 697.globl abi_test_clobber_v9_upper 698 699.align 4 700abi_test_clobber_v9_upper: 701 AARCH64_VALID_CALL_TARGET 702 fmov v9.d[1], xzr 703 ret 704 705 706.globl abi_test_clobber_v10_upper 707 708.align 4 709abi_test_clobber_v10_upper: 710 AARCH64_VALID_CALL_TARGET 711 fmov v10.d[1], xzr 712 ret 713 714 715.globl abi_test_clobber_v11_upper 716 717.align 4 718abi_test_clobber_v11_upper: 719 AARCH64_VALID_CALL_TARGET 720 fmov v11.d[1], xzr 721 ret 722 723 724.globl abi_test_clobber_v12_upper 725 726.align 4 727abi_test_clobber_v12_upper: 728 AARCH64_VALID_CALL_TARGET 729 fmov v12.d[1], xzr 730 ret 731 732 733.globl abi_test_clobber_v13_upper 734 735.align 4 736abi_test_clobber_v13_upper: 737 AARCH64_VALID_CALL_TARGET 738 fmov v13.d[1], xzr 739 ret 740 741 742.globl abi_test_clobber_v14_upper 743 744.align 4 745abi_test_clobber_v14_upper: 746 AARCH64_VALID_CALL_TARGET 747 fmov v14.d[1], xzr 748 ret 749 750 751.globl abi_test_clobber_v15_upper 752 753.align 4 754abi_test_clobber_v15_upper: 755 AARCH64_VALID_CALL_TARGET 756 fmov v15.d[1], xzr 757 ret 758 759#endif 760#endif // !OPENSSL_NO_ASM 761