Windows NT 4.0 source code leak
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.

115 lines
2.2 KiB

4 years ago
  1. #if defined(R4000)
  2. // TITLE("AllocateFree TB Entry")
  3. //++
  4. //
  5. // Copyright (c) 1992 Microsoft Corporation
  6. //
  7. // Module Name:
  8. //
  9. // x4tb.s
  10. //
  11. // Abstract:
  12. //
  13. // This module implements allocates and frees fixed TB entries using the
  14. // wired register.
  15. //
  16. // Author:
  17. //
  18. // David N. Cutler (davec) 29-Dec-1992
  19. //
  20. // Environment:
  21. //
  22. // Kernel mode only.
  23. //
  24. // Revision History:
  25. //
  26. //--
  27. #include "halmips.h"
  28. SBTTL("Allocate Tb Entry")
  29. //++
  30. //
  31. // ULONG
  32. // HalpAllocateTbEntry (
  33. // VOID
  34. // )
  35. //
  36. // Routine Description:
  37. //
  38. // This function allocates the TB entry specified by the wired register
  39. // and increments the wired register.
  40. //
  41. // Arguments:
  42. //
  43. // None.
  44. //
  45. // Return Value:
  46. //
  47. // The index of the allocated TB entry.
  48. //
  49. //--
  50. LEAF_ENTRY(HalpAllocateTbEntry)
  51. DISABLE_INTERRUPTS(t0) // disable interrupts
  52. .set noreorder
  53. .set noat
  54. mfc0 v0,wired // get contents of wired register
  55. nop // fill
  56. addu v1,v0,1 // allocate TB entry
  57. mtc0 v1,wired //
  58. .set at
  59. .set reorder
  60. ENABLE_INTERRUPTS(t0) // enable interrupts
  61. j ra // return
  62. .end HalpAllocateTbEntry
  63. SBTTL("Free Tb Entry")
  64. //++
  65. //
  66. // VOID
  67. // HalpAllocateTbEntry (
  68. // VOID
  69. // )
  70. //
  71. // Routine Description:
  72. //
  73. // This function frees the TB entry specified by the wired register
  74. // and decrements the wired register.
  75. //
  76. // Arguments:
  77. //
  78. // None.
  79. //
  80. // Return Value:
  81. //
  82. // None.
  83. //
  84. //--
  85. LEAF_ENTRY(HalpFreeTbEntry)
  86. DISABLE_INTERRUPTS(t0) // disable interrupts
  87. .set noreorder
  88. .set noat
  89. mfc0 v0,wired // get contents of wired register
  90. nop // fill
  91. subu v1,v0,1 // free TB entry
  92. mtc0 v1,wired //
  93. .set at
  94. .set reorder
  95. ENABLE_INTERRUPTS(t0) // enable interrupts
  96. j ra // return
  97. .end HalpFreeTbEntry
  98. #endif