ia64cpuid.S 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. // Works on all IA-64 platforms: Linux, HP-UX, Win64i...
  2. // On Win64i compile with ias.exe.
  3. .text
  4. .global OPENSSL_rdtsc#
  5. .proc OPENSSL_rdtsc#
  6. OPENSSL_rdtsc:
  7. { .mib; mov r8=ar.itc
  8. br.ret.sptk.many b0 };;
  9. .endp OPENSSL_rdtsc#
  10. .global OPENSSL_atomic_add#
  11. .proc OPENSSL_atomic_add#
  12. .align 32
  13. OPENSSL_atomic_add:
  14. { .mii; ld4 r2=[r32]
  15. nop.i 0
  16. nop.i 0 };;
  17. .Lspin:
  18. { .mii; mov ar.ccv=r2
  19. add r8=r2,r33
  20. mov r3=r2 };;
  21. { .mmi; mf
  22. cmpxchg4.acq r2=[r32],r8,ar.ccv
  23. nop.i 0 };;
  24. { .mib; cmp.ne p6,p0=r2,r3
  25. nop.i 0
  26. (p6) br.dpnt .Lspin };;
  27. { .mib; nop.m 0
  28. sxt4 r8=r8
  29. br.ret.sptk.many b0 };;
  30. .endp OPENSSL_atomic_add#
  31. // Returns a structure comprising pointer to the top of stack of
  32. // the caller and pointer beyond backing storage for the current
  33. // register frame. The latter is required, because it might be
  34. // insufficient to wipe backing storage for the current frame
  35. // (as this procedure does), one might have to go further, toward
  36. // higher addresses to reach for whole "retroactively" saved
  37. // context...
  38. .global OPENSSL_wipe_cpu#
  39. .proc OPENSSL_wipe_cpu#
  40. .align 32
  41. OPENSSL_wipe_cpu:
  42. .prologue
  43. .fframe 0
  44. .save ar.pfs,r2
  45. .save ar.lc,r3
  46. { .mib; alloc r2=ar.pfs,0,96,0,96
  47. mov r3=ar.lc
  48. brp.loop.imp .L_wipe_top,.L_wipe_end-16
  49. };;
  50. { .mii; mov r9=ar.bsp
  51. mov r8=pr
  52. mov ar.lc=96 };;
  53. .body
  54. { .mii; add r9=96*8-8,r9
  55. mov ar.ec=1 };;
  56. // One can sweep double as fast, but then we can't quarantee
  57. // that backing storage is wiped...
  58. .L_wipe_top:
  59. { .mfi; st8 [r9]=r0,-8
  60. mov f127=f0
  61. mov r127=r0 }
  62. { .mfb; nop.m 0
  63. nop.f 0
  64. br.ctop.sptk .L_wipe_top };;
  65. .L_wipe_end:
  66. { .mfi; mov r11=r0
  67. mov f6=f0
  68. mov r14=r0 }
  69. { .mfi; mov r15=r0
  70. mov f7=f0
  71. mov r16=r0 }
  72. { .mfi; mov r17=r0
  73. mov f8=f0
  74. mov r18=r0 }
  75. { .mfi; mov r19=r0
  76. mov f9=f0
  77. mov r20=r0 }
  78. { .mfi; mov r21=r0
  79. mov f10=f0
  80. mov r22=r0 }
  81. { .mfi; mov r23=r0
  82. mov f11=f0
  83. mov r24=r0 }
  84. { .mfi; mov r25=r0
  85. mov f12=f0
  86. mov r26=r0 }
  87. { .mfi; mov r27=r0
  88. mov f13=f0
  89. mov r28=r0 }
  90. { .mfi; mov r29=r0
  91. mov f14=f0
  92. mov r30=r0 }
  93. { .mfi; mov r31=r0
  94. mov f15=f0
  95. nop.i 0 }
  96. { .mfi; mov f16=f0 }
  97. { .mfi; mov f17=f0 }
  98. { .mfi; mov f18=f0 }
  99. { .mfi; mov f19=f0 }
  100. { .mfi; mov f20=f0 }
  101. { .mfi; mov f21=f0 }
  102. { .mfi; mov f22=f0 }
  103. { .mfi; mov f23=f0 }
  104. { .mfi; mov f24=f0 }
  105. { .mfi; mov f25=f0 }
  106. { .mfi; mov f26=f0 }
  107. { .mfi; mov f27=f0 }
  108. { .mfi; mov f28=f0 }
  109. { .mfi; mov f29=f0 }
  110. { .mfi; mov f30=f0 }
  111. { .mfi; add r9=96*8+8,r9
  112. mov f31=f0
  113. mov pr=r8,0x1ffff }
  114. { .mib; mov r8=sp
  115. mov ar.lc=r3
  116. br.ret.sptk b0 };;
  117. .endp OPENSSL_wipe_cpu#