s390xcpuid.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. .text
  2. .globl OPENSSL_s390x_facilities
  3. .type OPENSSL_s390x_facilities,@function
  4. .align 16
  5. OPENSSL_s390x_facilities:
  6. lghi %r0,0
  7. .long 0xb2b0f010 # stfle 16(%r15)
  8. lg %r2,16(%r15)
  9. larl %r1,OPENSSL_s390xcap_P
  10. stg %r2,0(%r1)
  11. br %r14
  12. .size OPENSSL_s390x_facilities,.-OPENSSL_s390x_facilities
  13. .globl OPENSSL_rdtsc
  14. .type OPENSSL_rdtsc,@function
  15. .align 16
  16. OPENSSL_rdtsc:
  17. stck 16(%r15)
  18. lg %r2,16(%r15)
  19. br %r14
  20. .size OPENSSL_rdtsc,.-OPENSSL_rdtsc
  21. .globl OPENSSL_atomic_add
  22. .type OPENSSL_atomic_add,@function
  23. .align 16
  24. OPENSSL_atomic_add:
  25. l %r1,0(%r2)
  26. .Lspin: lr %r0,%r1
  27. ar %r0,%r3
  28. cs %r1,%r0,0(%r2)
  29. brc 4,.Lspin
  30. lgfr %r2,%r0 # OpenSSL expects the new value
  31. br %r14
  32. .size OPENSSL_atomic_add,.-OPENSSL_atomic_add
  33. .globl OPENSSL_wipe_cpu
  34. .type OPENSSL_wipe_cpu,@function
  35. .align 16
  36. OPENSSL_wipe_cpu:
  37. xgr %r0,%r0
  38. xgr %r1,%r1
  39. lgr %r2,%r15
  40. xgr %r3,%r3
  41. xgr %r4,%r4
  42. lzdr %f0
  43. lzdr %f1
  44. lzdr %f2
  45. lzdr %f3
  46. lzdr %f4
  47. lzdr %f5
  48. lzdr %f6
  49. lzdr %f7
  50. br %r14
  51. .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
  52. .globl OPENSSL_cleanse
  53. .type OPENSSL_cleanse,@function
  54. .align 16
  55. OPENSSL_cleanse:
  56. lghi %r4,15
  57. lghi %r0,0
  58. clgr %r3,%r4
  59. jh .Lot
  60. clgr %r3,%r0
  61. bcr 8,%r14
  62. .Little:
  63. stc %r0,0(%r2)
  64. la %r2,1(%r2)
  65. brctg %r3,.Little
  66. br %r14
  67. .align 4
  68. .Lot: tmll %r2,7
  69. jz .Laligned
  70. stc %r0,0(%r2)
  71. la %r2,1(%r2)
  72. brctg %r3,.Lot
  73. .Laligned:
  74. srlg %r4,%r3,3
  75. .Loop: stg %r0,0(%r2)
  76. la %r2,8(%r2)
  77. brctg %r4,.Loop
  78. lghi %r4,7
  79. ngr %r3,%r4
  80. jnz .Little
  81. br %r14
  82. .size OPENSSL_cleanse,.-OPENSSL_cleanse
  83. .section .init
  84. brasl %r14,OPENSSL_cpuid_setup
  85. .comm OPENSSL_s390xcap_P,8,8