x86cpuid.S revision 305153
1/* $FreeBSD: stable/11/secure/lib/libcrypto/i386/x86cpuid.S 305153 2016-08-31 20:33:59Z jkim $ */ 2/* Do not modify. This file is auto-generated from x86cpuid.pl. */ 3#ifdef PIC 4.file "x86cpuid.S" 5.text 6.globl OPENSSL_ia32_cpuid 7.type OPENSSL_ia32_cpuid,@function 8.align 16 9OPENSSL_ia32_cpuid: 10.L_OPENSSL_ia32_cpuid_begin: 11 pushl %ebp 12 pushl %ebx 13 pushl %esi 14 pushl %edi 15 xorl %edx,%edx 16 pushfl 17 popl %eax 18 movl %eax,%ecx 19 xorl $2097152,%eax 20 pushl %eax 21 popfl 22 pushfl 23 popl %eax 24 xorl %eax,%ecx 25 xorl %eax,%eax 26 btl $21,%ecx 27 jnc .L000nocpuid 28 movl 20(%esp),%esi 29 movl %eax,8(%esi) 30 .byte 0x0f,0xa2 31 movl %eax,%edi 32 xorl %eax,%eax 33 cmpl $1970169159,%ebx 34 setne %al 35 movl %eax,%ebp 36 cmpl $1231384169,%edx 37 setne %al 38 orl %eax,%ebp 39 cmpl $1818588270,%ecx 40 setne %al 41 orl %eax,%ebp 42 jz .L001intel 43 cmpl $1752462657,%ebx 44 setne %al 45 movl %eax,%esi 46 cmpl $1769238117,%edx 47 setne %al 48 orl %eax,%esi 49 cmpl $1145913699,%ecx 50 setne %al 51 orl %eax,%esi 52 jnz .L001intel 53 movl $2147483648,%eax 54 .byte 0x0f,0xa2 55 cmpl $2147483649,%eax 56 jb .L001intel 57 movl %eax,%esi 58 movl $2147483649,%eax 59 .byte 0x0f,0xa2 60 orl %ecx,%ebp 61 andl $2049,%ebp 62 cmpl $2147483656,%esi 63 jb .L001intel 64 movl $2147483656,%eax 65 .byte 0x0f,0xa2 66 movzbl %cl,%esi 67 incl %esi 68 movl $1,%eax 69 xorl %ecx,%ecx 70 .byte 0x0f,0xa2 71 btl $28,%edx 72 jnc .L002generic 73 shrl $16,%ebx 74 andl $255,%ebx 75 cmpl %esi,%ebx 76 ja .L002generic 77 andl $4026531839,%edx 78 jmp .L002generic 79.L001intel: 80 cmpl $7,%edi 81 jb .L003cacheinfo 82 movl 20(%esp),%esi 83 movl $7,%eax 84 xorl %ecx,%ecx 85 .byte 0x0f,0xa2 86 movl %ebx,8(%esi) 87.L003cacheinfo: 88 cmpl $4,%edi 89 movl $-1,%edi 90 jb .L004nocacheinfo 91 movl $4,%eax 92 movl $0,%ecx 93 .byte 0x0f,0xa2 94 movl %eax,%edi 95 shrl $14,%edi 96 andl $4095,%edi 97.L004nocacheinfo: 98 movl $1,%eax 99 xorl %ecx,%ecx 100 .byte 0x0f,0xa2 101 andl $3220176895,%edx 102 cmpl $0,%ebp 103 jne .L005notintel 104 orl $1073741824,%edx 105 andb $15,%ah 106 cmpb $15,%ah 107 jne .L005notintel 108 orl $1048576,%edx 109.L005notintel: 110 btl $28,%edx 111 jnc .L002generic 112 andl $4026531839,%edx 113 cmpl $0,%edi 114 je .L002generic 115 orl $268435456,%edx 116 shrl $16,%ebx 117 cmpb $1,%bl 118 ja .L002generic 119 andl $4026531839,%edx 120.L002generic: 121 andl $2048,%ebp 122 andl $4294965247,%ecx 123 movl %edx,%esi 124 orl %ecx,%ebp 125 btl $27,%ecx 126 jnc .L006clear_avx 127 xorl %ecx,%ecx 128.byte 15,1,208 129 andl $6,%eax 130 cmpl $6,%eax 131 je .L007done 132 cmpl $2,%eax 133 je .L006clear_avx 134.L008clear_xmm: 135 andl $4261412861,%ebp 136 andl $4278190079,%esi 137.L006clear_avx: 138 andl $4026525695,%ebp 139 movl 20(%esp),%edi 140 andl $4294967263,8(%edi) 141.L007done: 142 movl %esi,%eax 143 movl %ebp,%edx 144.L000nocpuid: 145 popl %edi 146 popl %esi 147 popl %ebx 148 popl %ebp 149 ret 150.size OPENSSL_ia32_cpuid,.-.L_OPENSSL_ia32_cpuid_begin 151.globl OPENSSL_rdtsc 152.type OPENSSL_rdtsc,@function 153.align 16 154OPENSSL_rdtsc: 155.L_OPENSSL_rdtsc_begin: 156 xorl %eax,%eax 157 xorl %edx,%edx 158 call .L009PIC_me_up 159.L009PIC_me_up: 160 popl %ecx 161 leal OPENSSL_ia32cap_P-.L009PIC_me_up(%ecx),%ecx 162 btl $4,(%ecx) 163 jnc .L010notsc 164 .byte 0x0f,0x31 165.L010notsc: 166 ret 167.size OPENSSL_rdtsc,.-.L_OPENSSL_rdtsc_begin 168.globl OPENSSL_instrument_halt 169.type OPENSSL_instrument_halt,@function 170.align 16 171OPENSSL_instrument_halt: 172.L_OPENSSL_instrument_halt_begin: 173 call .L011PIC_me_up 174.L011PIC_me_up: 175 popl %ecx 176 leal OPENSSL_ia32cap_P-.L011PIC_me_up(%ecx),%ecx 177 btl $4,(%ecx) 178 jnc .L012nohalt 179.long 2421723150 180 andl $3,%eax 181 jnz .L012nohalt 182 pushfl 183 popl %eax 184 btl $9,%eax 185 jnc .L012nohalt 186 .byte 0x0f,0x31 187 pushl %edx 188 pushl %eax 189 hlt 190 .byte 0x0f,0x31 191 subl (%esp),%eax 192 sbbl 4(%esp),%edx 193 addl $8,%esp 194 ret 195.L012nohalt: 196 xorl %eax,%eax 197 xorl %edx,%edx 198 ret 199.size OPENSSL_instrument_halt,.-.L_OPENSSL_instrument_halt_begin 200.globl OPENSSL_far_spin 201.type OPENSSL_far_spin,@function 202.align 16 203OPENSSL_far_spin: 204.L_OPENSSL_far_spin_begin: 205 pushfl 206 popl %eax 207 btl $9,%eax 208 jnc .L013nospin 209 movl 4(%esp),%eax 210 movl 8(%esp),%ecx 211.long 2430111262 212 xorl %eax,%eax 213 movl (%ecx),%edx 214 jmp .L014spin 215.align 16 216.L014spin: 217 incl %eax 218 cmpl (%ecx),%edx 219 je .L014spin 220.long 529567888 221 ret 222.L013nospin: 223 xorl %eax,%eax 224 xorl %edx,%edx 225 ret 226.size OPENSSL_far_spin,.-.L_OPENSSL_far_spin_begin 227.globl OPENSSL_wipe_cpu 228.type OPENSSL_wipe_cpu,@function 229.align 16 230OPENSSL_wipe_cpu: 231.L_OPENSSL_wipe_cpu_begin: 232 xorl %eax,%eax 233 xorl %edx,%edx 234 call .L015PIC_me_up 235.L015PIC_me_up: 236 popl %ecx 237 leal OPENSSL_ia32cap_P-.L015PIC_me_up(%ecx),%ecx 238 movl (%ecx),%ecx 239 btl $1,(%ecx) 240 jnc .L016no_x87 241 andl $83886080,%ecx 242 cmpl $83886080,%ecx 243 jne .L017no_sse2 244 pxor %xmm0,%xmm0 245 pxor %xmm1,%xmm1 246 pxor %xmm2,%xmm2 247 pxor %xmm3,%xmm3 248 pxor %xmm4,%xmm4 249 pxor %xmm5,%xmm5 250 pxor %xmm6,%xmm6 251 pxor %xmm7,%xmm7 252.L017no_sse2: 253.long 4007259865,4007259865,4007259865,4007259865,2430851995 254.L016no_x87: 255 leal 4(%esp),%eax 256 ret 257.size OPENSSL_wipe_cpu,.-.L_OPENSSL_wipe_cpu_begin 258.globl OPENSSL_atomic_add 259.type OPENSSL_atomic_add,@function 260.align 16 261OPENSSL_atomic_add: 262.L_OPENSSL_atomic_add_begin: 263 movl 4(%esp),%edx 264 movl 8(%esp),%ecx 265 pushl %ebx 266 nop 267 movl (%edx),%eax 268.L018spin: 269 leal (%eax,%ecx,1),%ebx 270 nop 271.long 447811568 272 jne .L018spin 273 movl %ebx,%eax 274 popl %ebx 275 ret 276.size OPENSSL_atomic_add,.-.L_OPENSSL_atomic_add_begin 277.globl OPENSSL_indirect_call 278.type OPENSSL_indirect_call,@function 279.align 16 280OPENSSL_indirect_call: 281.L_OPENSSL_indirect_call_begin: 282 pushl %ebp 283 movl %esp,%ebp 284 subl $28,%esp 285 movl 12(%ebp),%ecx 286 movl %ecx,(%esp) 287 movl 16(%ebp),%edx 288 movl %edx,4(%esp) 289 movl 20(%ebp),%eax 290 movl %eax,8(%esp) 291 movl 24(%ebp),%eax 292 movl %eax,12(%esp) 293 movl 28(%ebp),%eax 294 movl %eax,16(%esp) 295 movl 32(%ebp),%eax 296 movl %eax,20(%esp) 297 movl 36(%ebp),%eax 298 movl %eax,24(%esp) 299 call *8(%ebp) 300 movl %ebp,%esp 301 popl %ebp 302 ret 303.size OPENSSL_indirect_call,.-.L_OPENSSL_indirect_call_begin 304.globl OPENSSL_cleanse 305.type OPENSSL_cleanse,@function 306.align 16 307OPENSSL_cleanse: 308.L_OPENSSL_cleanse_begin: 309 movl 4(%esp),%edx 310 movl 8(%esp),%ecx 311 xorl %eax,%eax 312 cmpl $7,%ecx 313 jae .L019lot 314 cmpl $0,%ecx 315 je .L020ret 316.L021little: 317 movb %al,(%edx) 318 subl $1,%ecx 319 leal 1(%edx),%edx 320 jnz .L021little 321.L020ret: 322 ret 323.align 16 324.L019lot: 325 testl $3,%edx 326 jz .L022aligned 327 movb %al,(%edx) 328 leal -1(%ecx),%ecx 329 leal 1(%edx),%edx 330 jmp .L019lot 331.L022aligned: 332 movl %eax,(%edx) 333 leal -4(%ecx),%ecx 334 testl $-4,%ecx 335 leal 4(%edx),%edx 336 jnz .L022aligned 337 cmpl $0,%ecx 338 jne .L021little 339 ret 340.size OPENSSL_cleanse,.-.L_OPENSSL_cleanse_begin 341.globl OPENSSL_ia32_rdrand 342.type OPENSSL_ia32_rdrand,@function 343.align 16 344OPENSSL_ia32_rdrand: 345.L_OPENSSL_ia32_rdrand_begin: 346 movl $8,%ecx 347.L023loop: 348.byte 15,199,240 349 jc .L024break 350 loop .L023loop 351.L024break: 352 cmpl $0,%eax 353 cmovel %ecx,%eax 354 ret 355.size OPENSSL_ia32_rdrand,.-.L_OPENSSL_ia32_rdrand_begin 356.globl OPENSSL_ia32_rdseed 357.type OPENSSL_ia32_rdseed,@function 358.align 16 359OPENSSL_ia32_rdseed: 360.L_OPENSSL_ia32_rdseed_begin: 361 movl $8,%ecx 362.L025loop: 363.byte 15,199,248 364 jc .L026break 365 loop .L025loop 366.L026break: 367 cmpl $0,%eax 368 cmovel %ecx,%eax 369 ret 370.size OPENSSL_ia32_rdseed,.-.L_OPENSSL_ia32_rdseed_begin 371.hidden OPENSSL_cpuid_setup 372.hidden OPENSSL_ia32cap_P 373.comm OPENSSL_ia32cap_P,16,4 374.section .init 375 call OPENSSL_cpuid_setup 376#else 377.file "x86cpuid.S" 378.text 379.globl OPENSSL_ia32_cpuid 380.type OPENSSL_ia32_cpuid,@function 381.align 16 382OPENSSL_ia32_cpuid: 383.L_OPENSSL_ia32_cpuid_begin: 384 pushl %ebp 385 pushl %ebx 386 pushl %esi 387 pushl %edi 388 xorl %edx,%edx 389 pushfl 390 popl %eax 391 movl %eax,%ecx 392 xorl $2097152,%eax 393 pushl %eax 394 popfl 395 pushfl 396 popl %eax 397 xorl %eax,%ecx 398 xorl %eax,%eax 399 btl $21,%ecx 400 jnc .L000nocpuid 401 movl 20(%esp),%esi 402 movl %eax,8(%esi) 403 .byte 0x0f,0xa2 404 movl %eax,%edi 405 xorl %eax,%eax 406 cmpl $1970169159,%ebx 407 setne %al 408 movl %eax,%ebp 409 cmpl $1231384169,%edx 410 setne %al 411 orl %eax,%ebp 412 cmpl $1818588270,%ecx 413 setne %al 414 orl %eax,%ebp 415 jz .L001intel 416 cmpl $1752462657,%ebx 417 setne %al 418 movl %eax,%esi 419 cmpl $1769238117,%edx 420 setne %al 421 orl %eax,%esi 422 cmpl $1145913699,%ecx 423 setne %al 424 orl %eax,%esi 425 jnz .L001intel 426 movl $2147483648,%eax 427 .byte 0x0f,0xa2 428 cmpl $2147483649,%eax 429 jb .L001intel 430 movl %eax,%esi 431 movl $2147483649,%eax 432 .byte 0x0f,0xa2 433 orl %ecx,%ebp 434 andl $2049,%ebp 435 cmpl $2147483656,%esi 436 jb .L001intel 437 movl $2147483656,%eax 438 .byte 0x0f,0xa2 439 movzbl %cl,%esi 440 incl %esi 441 movl $1,%eax 442 xorl %ecx,%ecx 443 .byte 0x0f,0xa2 444 btl $28,%edx 445 jnc .L002generic 446 shrl $16,%ebx 447 andl $255,%ebx 448 cmpl %esi,%ebx 449 ja .L002generic 450 andl $4026531839,%edx 451 jmp .L002generic 452.L001intel: 453 cmpl $7,%edi 454 jb .L003cacheinfo 455 movl 20(%esp),%esi 456 movl $7,%eax 457 xorl %ecx,%ecx 458 .byte 0x0f,0xa2 459 movl %ebx,8(%esi) 460.L003cacheinfo: 461 cmpl $4,%edi 462 movl $-1,%edi 463 jb .L004nocacheinfo 464 movl $4,%eax 465 movl $0,%ecx 466 .byte 0x0f,0xa2 467 movl %eax,%edi 468 shrl $14,%edi 469 andl $4095,%edi 470.L004nocacheinfo: 471 movl $1,%eax 472 xorl %ecx,%ecx 473 .byte 0x0f,0xa2 474 andl $3220176895,%edx 475 cmpl $0,%ebp 476 jne .L005notintel 477 orl $1073741824,%edx 478 andb $15,%ah 479 cmpb $15,%ah 480 jne .L005notintel 481 orl $1048576,%edx 482.L005notintel: 483 btl $28,%edx 484 jnc .L002generic 485 andl $4026531839,%edx 486 cmpl $0,%edi 487 je .L002generic 488 orl $268435456,%edx 489 shrl $16,%ebx 490 cmpb $1,%bl 491 ja .L002generic 492 andl $4026531839,%edx 493.L002generic: 494 andl $2048,%ebp 495 andl $4294965247,%ecx 496 movl %edx,%esi 497 orl %ecx,%ebp 498 btl $27,%ecx 499 jnc .L006clear_avx 500 xorl %ecx,%ecx 501.byte 15,1,208 502 andl $6,%eax 503 cmpl $6,%eax 504 je .L007done 505 cmpl $2,%eax 506 je .L006clear_avx 507.L008clear_xmm: 508 andl $4261412861,%ebp 509 andl $4278190079,%esi 510.L006clear_avx: 511 andl $4026525695,%ebp 512 movl 20(%esp),%edi 513 andl $4294967263,8(%edi) 514.L007done: 515 movl %esi,%eax 516 movl %ebp,%edx 517.L000nocpuid: 518 popl %edi 519 popl %esi 520 popl %ebx 521 popl %ebp 522 ret 523.size OPENSSL_ia32_cpuid,.-.L_OPENSSL_ia32_cpuid_begin 524.globl OPENSSL_rdtsc 525.type OPENSSL_rdtsc,@function 526.align 16 527OPENSSL_rdtsc: 528.L_OPENSSL_rdtsc_begin: 529 xorl %eax,%eax 530 xorl %edx,%edx 531 leal OPENSSL_ia32cap_P,%ecx 532 btl $4,(%ecx) 533 jnc .L009notsc 534 .byte 0x0f,0x31 535.L009notsc: 536 ret 537.size OPENSSL_rdtsc,.-.L_OPENSSL_rdtsc_begin 538.globl OPENSSL_instrument_halt 539.type OPENSSL_instrument_halt,@function 540.align 16 541OPENSSL_instrument_halt: 542.L_OPENSSL_instrument_halt_begin: 543 leal OPENSSL_ia32cap_P,%ecx 544 btl $4,(%ecx) 545 jnc .L010nohalt 546.long 2421723150 547 andl $3,%eax 548 jnz .L010nohalt 549 pushfl 550 popl %eax 551 btl $9,%eax 552 jnc .L010nohalt 553 .byte 0x0f,0x31 554 pushl %edx 555 pushl %eax 556 hlt 557 .byte 0x0f,0x31 558 subl (%esp),%eax 559 sbbl 4(%esp),%edx 560 addl $8,%esp 561 ret 562.L010nohalt: 563 xorl %eax,%eax 564 xorl %edx,%edx 565 ret 566.size OPENSSL_instrument_halt,.-.L_OPENSSL_instrument_halt_begin 567.globl OPENSSL_far_spin 568.type OPENSSL_far_spin,@function 569.align 16 570OPENSSL_far_spin: 571.L_OPENSSL_far_spin_begin: 572 pushfl 573 popl %eax 574 btl $9,%eax 575 jnc .L011nospin 576 movl 4(%esp),%eax 577 movl 8(%esp),%ecx 578.long 2430111262 579 xorl %eax,%eax 580 movl (%ecx),%edx 581 jmp .L012spin 582.align 16 583.L012spin: 584 incl %eax 585 cmpl (%ecx),%edx 586 je .L012spin 587.long 529567888 588 ret 589.L011nospin: 590 xorl %eax,%eax 591 xorl %edx,%edx 592 ret 593.size OPENSSL_far_spin,.-.L_OPENSSL_far_spin_begin 594.globl OPENSSL_wipe_cpu 595.type OPENSSL_wipe_cpu,@function 596.align 16 597OPENSSL_wipe_cpu: 598.L_OPENSSL_wipe_cpu_begin: 599 xorl %eax,%eax 600 xorl %edx,%edx 601 leal OPENSSL_ia32cap_P,%ecx 602 movl (%ecx),%ecx 603 btl $1,(%ecx) 604 jnc .L013no_x87 605 andl $83886080,%ecx 606 cmpl $83886080,%ecx 607 jne .L014no_sse2 608 pxor %xmm0,%xmm0 609 pxor %xmm1,%xmm1 610 pxor %xmm2,%xmm2 611 pxor %xmm3,%xmm3 612 pxor %xmm4,%xmm4 613 pxor %xmm5,%xmm5 614 pxor %xmm6,%xmm6 615 pxor %xmm7,%xmm7 616.L014no_sse2: 617.long 4007259865,4007259865,4007259865,4007259865,2430851995 618.L013no_x87: 619 leal 4(%esp),%eax 620 ret 621.size OPENSSL_wipe_cpu,.-.L_OPENSSL_wipe_cpu_begin 622.globl OPENSSL_atomic_add 623.type OPENSSL_atomic_add,@function 624.align 16 625OPENSSL_atomic_add: 626.L_OPENSSL_atomic_add_begin: 627 movl 4(%esp),%edx 628 movl 8(%esp),%ecx 629 pushl %ebx 630 nop 631 movl (%edx),%eax 632.L015spin: 633 leal (%eax,%ecx,1),%ebx 634 nop 635.long 447811568 636 jne .L015spin 637 movl %ebx,%eax 638 popl %ebx 639 ret 640.size OPENSSL_atomic_add,.-.L_OPENSSL_atomic_add_begin 641.globl OPENSSL_indirect_call 642.type OPENSSL_indirect_call,@function 643.align 16 644OPENSSL_indirect_call: 645.L_OPENSSL_indirect_call_begin: 646 pushl %ebp 647 movl %esp,%ebp 648 subl $28,%esp 649 movl 12(%ebp),%ecx 650 movl %ecx,(%esp) 651 movl 16(%ebp),%edx 652 movl %edx,4(%esp) 653 movl 20(%ebp),%eax 654 movl %eax,8(%esp) 655 movl 24(%ebp),%eax 656 movl %eax,12(%esp) 657 movl 28(%ebp),%eax 658 movl %eax,16(%esp) 659 movl 32(%ebp),%eax 660 movl %eax,20(%esp) 661 movl 36(%ebp),%eax 662 movl %eax,24(%esp) 663 call *8(%ebp) 664 movl %ebp,%esp 665 popl %ebp 666 ret 667.size OPENSSL_indirect_call,.-.L_OPENSSL_indirect_call_begin 668.globl OPENSSL_cleanse 669.type OPENSSL_cleanse,@function 670.align 16 671OPENSSL_cleanse: 672.L_OPENSSL_cleanse_begin: 673 movl 4(%esp),%edx 674 movl 8(%esp),%ecx 675 xorl %eax,%eax 676 cmpl $7,%ecx 677 jae .L016lot 678 cmpl $0,%ecx 679 je .L017ret 680.L018little: 681 movb %al,(%edx) 682 subl $1,%ecx 683 leal 1(%edx),%edx 684 jnz .L018little 685.L017ret: 686 ret 687.align 16 688.L016lot: 689 testl $3,%edx 690 jz .L019aligned 691 movb %al,(%edx) 692 leal -1(%ecx),%ecx 693 leal 1(%edx),%edx 694 jmp .L016lot 695.L019aligned: 696 movl %eax,(%edx) 697 leal -4(%ecx),%ecx 698 testl $-4,%ecx 699 leal 4(%edx),%edx 700 jnz .L019aligned 701 cmpl $0,%ecx 702 jne .L018little 703 ret 704.size OPENSSL_cleanse,.-.L_OPENSSL_cleanse_begin 705.globl OPENSSL_ia32_rdrand 706.type OPENSSL_ia32_rdrand,@function 707.align 16 708OPENSSL_ia32_rdrand: 709.L_OPENSSL_ia32_rdrand_begin: 710 movl $8,%ecx 711.L020loop: 712.byte 15,199,240 713 jc .L021break 714 loop .L020loop 715.L021break: 716 cmpl $0,%eax 717 cmovel %ecx,%eax 718 ret 719.size OPENSSL_ia32_rdrand,.-.L_OPENSSL_ia32_rdrand_begin 720.globl OPENSSL_ia32_rdseed 721.type OPENSSL_ia32_rdseed,@function 722.align 16 723OPENSSL_ia32_rdseed: 724.L_OPENSSL_ia32_rdseed_begin: 725 movl $8,%ecx 726.L022loop: 727.byte 15,199,248 728 jc .L023break 729 loop .L022loop 730.L023break: 731 cmpl $0,%eax 732 cmovel %ecx,%eax 733 ret 734.size OPENSSL_ia32_rdseed,.-.L_OPENSSL_ia32_rdseed_begin 735.hidden OPENSSL_cpuid_setup 736.hidden OPENSSL_ia32cap_P 737.comm OPENSSL_ia32cap_P,16,4 738.section .init 739 call OPENSSL_cpuid_setup 740#endif 741