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