2
0

ia64cpuid.S 3.5 KB

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