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.

106 lines
1.9 KiB

  1. /* xmsa20.c - A20 related XMS routines
  2. *
  3. * XMSA20
  4. *
  5. * Modification History:
  6. *
  7. * Sudeepb 15-May-1991 Created
  8. */
  9. #include "xms.h"
  10. #include <xmssvc.h>
  11. #include <softpc.h>
  12. void sas_enable_20_bit_wrapping(void);
  13. void sas_disable_20_bit_wrapping(void);
  14. BOOL sas_twenty_bit_wrapping_enabled(void);
  15. BYTE * pHimemA20State = NULL;
  16. /* xmsA20 - Handle A20 requests
  17. *
  18. *
  19. * Entry - Client (AX) 0 - Disable A20
  20. * 1 - Enable A20
  21. * 2 - Query
  22. *
  23. * Exit
  24. * SUCCESS
  25. * Client (AX) = 1
  26. * if on entry AX=2 Then
  27. * Cleint (AX) =1 means was enabled
  28. * Cleint (AX) =0 means was disabled
  29. *
  30. * FAILURE
  31. * Client (AX) = 0
  32. */
  33. VOID xmsA20 (VOID)
  34. {
  35. int reason;
  36. reason = getAX();
  37. setAX(1);
  38. if (reason == 0)
  39. xmsEnableA20Wrapping();
  40. else if (reason == 1)
  41. xmsDisableA20Wrapping();
  42. else if (reason == 2) {
  43. if (sas_twenty_bit_wrapping_enabled())
  44. setAX(0);
  45. setBL(0);
  46. }
  47. else
  48. setAX(0);
  49. }
  50. // function to enable 1MB wrapping (turn off A20 line)
  51. VOID xmsEnableA20Wrapping(VOID)
  52. {
  53. sas_enable_20_bit_wrapping();
  54. if (pHimemA20State != NULL)
  55. *pHimemA20State = 0;
  56. #if 0 // this is not necessay because the intel space(pointed by
  57. // HimemA20State) doesn't contain instruction
  58. // doesn't contain instruction
  59. #ifdef MIPS
  60. Sim32FlushVDMPointer
  61. (
  62. (((ULONG)pHimemA20State >> 4) << 16) | ((ULONG)pHimemA20State & 0xF),
  63. 1,
  64. pHimemA20State,
  65. FALSE
  66. );
  67. #endif
  68. #endif
  69. }
  70. // function to disable 1MB wrapping(turn on A20 line)
  71. VOID xmsDisableA20Wrapping(VOID)
  72. {
  73. sas_disable_20_bit_wrapping();
  74. if (pHimemA20State != NULL)
  75. *pHimemA20State = 1;
  76. #if 0 // this is not necessay because the intel space(pointed by
  77. // HimemA20State) doesn't contain instruction
  78. // doesn't contain instruction
  79. #ifdef MIPS
  80. Sim32FlushVDMPointer
  81. (
  82. (((ULONG)pHimemA20State >> 4) << 16) | ((ULONG)pHimemA20State & 0xF),
  83. 1,
  84. pHimemA20State,
  85. FALSE
  86. );
  87. #endif
  88. #endif
  89. }