Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
2.3 KiB

  1. //
  2. //
  3. // Module Name: miscs.s
  4. //
  5. // Description:
  6. //
  7. // miscellaneous assembly functions used by hal.
  8. //
  9. // Target Platform:
  10. //
  11. // IA-64
  12. //
  13. // Reuse: None
  14. //
  15. //
  16. #include "regia64.h"
  17. #include "kxia64.h"
  18. //++
  19. // Name: HalpLockedIncrementUlong(Sync)
  20. //
  21. // Routine Description:
  22. //
  23. // Atomically increment a variable.
  24. //
  25. // Arguments:
  26. //
  27. // Sync: Synchronization variable
  28. //
  29. // Return Value: NONE
  30. //
  31. //--
  32. LEAF_ENTRY(HalpLockedIncrementUlong)
  33. LEAF_SETUP(1,2,0,0)
  34. ARGPTR(a0)
  35. ;;
  36. fetchadd4.acq.nt1 t1 = [a0], 1
  37. ;;
  38. LEAF_RETURN
  39. LEAF_EXIT(HalpLockedIncrementUlong)
  40. //++
  41. // Name: HalpGetReturnAddress()
  42. //
  43. // Routine Description:
  44. //
  45. // Returns b0
  46. //
  47. // Arguments:
  48. //
  49. // NONE
  50. //
  51. // Return Value: b0
  52. //
  53. //--
  54. LEAF_ENTRY(HalpGetReturnAddress)
  55. LEAF_SETUP(0,2,0,0)
  56. mov v0 = b0
  57. ;;
  58. LEAF_RETURN
  59. LEAF_EXIT(HalpGetReturnAddress)
  60. //++
  61. // VOID
  62. // HalSweepIcacheRange (
  63. // IN PVOID BaseAddress,
  64. // IN SIZE_T Length
  65. // )
  66. //
  67. //
  68. // Routine Description:
  69. // This function sweeps the range of address in the I cache throughout the
  70. // system.
  71. //
  72. // Arguments:
  73. // BaseAddress - Supplies the starting virtual address of a range of
  74. // virtual addresses that are to be flushed from the data cache.
  75. //
  76. // Length - Supplies the length of the range of virtual addresses
  77. // that are to be flushed from the data cache.
  78. //
  79. //
  80. // Return Value:
  81. //
  82. // None.
  83. //
  84. //
  85. // PS: HalSweepIcacheRange just flushes the cache. It does not synchrnoize the
  86. // I-Fetch pipeline with the flush operation. To Achieve pipeline flush also,
  87. // one has to call KeSweepCacheRange.
  88. //--
  89. .global CacheFlushStride
  90. LEAF_ENTRY(HalSweepIcacheRange)
  91. LEAF_SETUP(2,0,0,0)
  92. addl r26=@gprel(CacheFlushStride),gp
  93. add r29=r32, r33
  94. ;;
  95. ld4 r30=[r26]
  96. ;;
  97. adds r28=-1, r30
  98. ;;
  99. andcm r27=r32, r28
  100. ;;
  101. $L16123:
  102. // fc r27
  103. fc.i r27
  104. add r27=r30, r27
  105. ;;
  106. cmp.ltu p14,p15=r27, r29
  107. (p14) br.cond.dptk.few $L16123
  108. ;;
  109. br.ret.sptk.few b0
  110. ;;
  111. LEAF_RETURN
  112. LEAF_EXIT(HalSweepIcacheRange)