Source code of Windows XP (NT5)
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.

100 lines
2.4 KiB

  1. /**********************************************************************
  2. Copyright (c) 1992-1995 Microsoft Corporation
  3. locks.c
  4. DESCRIPTION:
  5. Code to lock each of the FIX'ed segments so they are only
  6. fixed when they need to be.
  7. HISTORY:
  8. 03/03/94 [jimge] created.
  9. *********************************************************************/
  10. #include "preclude.h"
  11. #include <windows.h>
  12. #include <windowsx.h>
  13. #include <mmsystem.h>
  14. #include <mmddk.h>
  15. #include "idf.h"
  16. #include "midimap.h"
  17. #include "debug.h"
  18. // Lock/unlock routines for code segments are stored in that segment
  19. // so we know the segment will be in memory when GlobalSmartPageLock
  20. // is called (else it will fail).
  21. //
  22. #ifndef WIN32
  23. #pragma allocTEXT ext(TEXT EXT, LockMapperData)
  24. #pragma allocTEXT ext(TEXT EXT, UnlockMapperData)
  25. #pragma allocTEXT ext(MAPPACKED_FIX, LockPackedMapper)
  26. #pragma allocTEXT ext(MAPPACKED_FIX, UnlockPackedMapper)
  27. #pragma allocTEXT ext(MAPCOOKED_FIX, LockCookedMapper)
  28. #pragma allocTEXT ext(MAPCOOKED_FIX, UnlockCookedMapper)
  29. #endif // End #ifndef WIN32
  30. void FNGLOBAL LockMapperData(
  31. void)
  32. {
  33. DPF(2, TEXT ("LockMapperData"));
  34. if (!GlobalSmartPageLock(__segname("_DATA")))
  35. {
  36. DPF(1, TEXT ("LockMapperData: GlobalSmartPageLock() failed!!!"));
  37. }
  38. }
  39. void FNGLOBAL UnlockMapperData(
  40. void)
  41. {
  42. DPF(2, TEXT ("UnlockMapperData"));
  43. if (!GlobalSmartPageUnlock(__segname("_DATA")))
  44. {
  45. DPF(1, TEXT ("UnlockMapperData: GlobalSmartPageUnlock() failed!!!"));
  46. }
  47. }
  48. void FNGLOBAL LockPackedMapper(
  49. void)
  50. {
  51. DPF(2, TEXT ("LockPackedMapper"));
  52. if (!GlobalSmartPageLock(__segname("MAPPACKED_FIX")))
  53. {
  54. DPF(1, TEXT ("LockPackedMapper: GlobalSmartPageLock() failed!!!"));
  55. }
  56. }
  57. void FNGLOBAL UnlockPackedMapper(
  58. void)
  59. {
  60. DPF(2, TEXT ("UnlockPackedMapper"));
  61. if (!GlobalSmartPageUnlock(__segname("MAPPACKED_FIX")))
  62. {
  63. DPF(1, TEXT ("UnlockPackedMapper: GlobalSmartPageUnlock() failed!!!"));
  64. }
  65. }
  66. void FNGLOBAL LockCookedMapper(
  67. void)
  68. {
  69. DPF(2, TEXT ("LockCookedMapper"));
  70. if (!GlobalSmartPageLock(__segname("MAPCOOKED_FIX")))
  71. {
  72. DPF(1, TEXT ("LockCookedMapper: GlobalSmartPageLock() failed!!!"));
  73. }
  74. }
  75. void FNGLOBAL UnlockCookedMapper(
  76. void)
  77. {
  78. DPF(2, TEXT ("UnlockCookedMapper"));
  79. if (!GlobalSmartPageUnlock(__segname("MAPCOOKED_FIX")))
  80. {
  81. DPF(1, TEXT ("UnlockCookedMapper: GlobalSmartPageUnlock() failed!!!"));
  82. }
  83. }