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