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.

88 lines
3.8 KiB

  1. ;**************************************************************************
  2. ;* MEMMAN.ASM
  3. ;*
  4. ;* Returns information about the VMM.
  5. ;*
  6. ;**************************************************************************
  7. INCLUDE TOOLPRIV.INC
  8. sBegin CODE
  9. assumes CS,CODE
  10. ; MemManInfo
  11. ;
  12. ; Returns information through DPMI about the VMM
  13. cProc MemManInfo, <PUBLIC,FAR>, <si,di,ds>
  14. parmD lpMemMan
  15. localV DPMIBuffer,30h ;30h byte buffer for DPMI info
  16. cBegin
  17. mov ax,_DATA ;Get our data segment
  18. mov ds,ax
  19. ;** Fill the buffer with -1 so if the call messes up like
  20. ;** in 3.0 std mode we get the correct results
  21. push ss ;Point to the local variable block
  22. pop es
  23. lea di,DPMIBuffer ;Get offset of buffer
  24. mov cx,30h ;Max len of DPMI buffer
  25. mov al,0ffh ;-1
  26. rep stosb ;Fill buffer
  27. ;** Prepare to build public structure
  28. mov ax,0500h ;DPMI -- Get Free Memory Info
  29. lea di,DPMIBuffer ;Get offset of buffer
  30. int 31h ;Call DPMI
  31. jnc MMI_10 ;Success
  32. xor ax,ax ;Return FALSE
  33. jmp MMI_End ;Get out because of DPMI error
  34. MMI_10: lds si,lpMemMan ;Point to the MEMMANINFO structure
  35. ;** Fill MEMMANINFO structure
  36. mov ax,es:[di+0] ;Loword of largest free block
  37. mov WORD PTR [si].vmm_dwLargestFreeBlock,ax
  38. mov ax,es:[di+2] ;High word
  39. mov WORD PTR [si].vmm_dwLargestFreeBlock + 2,ax
  40. mov ax,es:[di+4] ;Loword of largest unlockable block
  41. mov WORD PTR [si].vmm_dwMaxPagesAvailable,ax
  42. mov ax,es:[di+6] ;Hiword
  43. mov WORD PTR [si].vmm_dwMaxPagesAvailable + 2,ax
  44. mov ax,es:[di+8] ;Loword of largest lockable page
  45. mov WORD PTR [si].vmm_dwMaxPagesLockable,ax
  46. mov ax,es:[di+0ah] ;Hiword
  47. mov WORD PTR [si].vmm_dwMaxPagesLockable + 2,ax
  48. mov ax,es:[di+0ch] ;Loword of linear address space
  49. mov WORD PTR [si].vmm_dwTotalLinearSpace,ax
  50. mov ax,es:[di+0eh] ;Hiword
  51. mov WORD PTR [si].vmm_dwTotalLinearSpace + 2,ax
  52. mov ax,es:[di+10h] ;Loword of number of unlocked pages
  53. mov WORD PTR [si].vmm_dwTotalUnlockedPages,ax
  54. mov ax,es:[di+12h] ;Hiword
  55. mov WORD PTR [si].vmm_dwTotalUnlockedPages + 2,ax
  56. mov ax,es:[di+14h] ;Loword of number of free pages
  57. mov WORD PTR [si].vmm_dwFreePages,ax
  58. mov ax,es:[di+16h] ;Hiword
  59. mov WORD PTR [si].vmm_dwFreePages + 2,ax
  60. mov ax,es:[di+18h] ;Loword of total physical pages
  61. mov WORD PTR [si].vmm_dwTotalPages,ax
  62. mov ax,es:[di+1ah] ;Hiword
  63. mov WORD PTR [si].vmm_dwTotalPages + 2,ax
  64. mov ax,es:[di+1ch] ;Loword of free lin addr space (pages)
  65. mov WORD PTR [si].vmm_dwFreeLinearSpace,ax
  66. mov ax,es:[di+1eh] ;Hiword
  67. mov WORD PTR [si].vmm_dwFreeLinearSpace + 2,ax
  68. mov ax,es:[di+20h] ;Loword of size of paging file (pages)
  69. mov WORD PTR [si].vmm_dwSwapFilePages,ax
  70. mov ax,es:[di+22h] ;Hiword
  71. mov WORD PTR [si].vmm_dwSwapFilePages + 2,ax
  72. mov [si].vmm_wPageSize,4096 ;Safe to hard code this for 386/486
  73. mov ax,TRUE ;Return TRUE
  74. MMI_End:
  75. cEnd
  76. sEnd
  77. END