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.

144 lines
2.9 KiB

  1. TITLE LDFASTB - FastBoot procedure
  2. .xlist
  3. include kernel.inc
  4. include newexe.inc
  5. include pdb.inc
  6. include tdb.inc
  7. .list
  8. .386
  9. externA __ahincr
  10. externFP GlobalReAlloc
  11. sBegin NRESCODE
  12. assumes CS,NRESCODE
  13. assumes DS,NOTHING
  14. assumes ES,NOTHING
  15. sEnd NRESCODE
  16. DataBegin
  17. externB Kernel_flags
  18. externW pGlobalHeap
  19. externW win_show
  20. externW hLoadBlock
  21. externW segLoadBlock
  22. externD lpBootApp
  23. externW cpShrink
  24. externW cpShrunk
  25. DataEnd
  26. sBegin INITCODE
  27. assumes CS,CODE
  28. assumes DS,NOTHING
  29. assumes ES,NOTHING
  30. externNP MyLock
  31. externNP get_arena_pointer32
  32. externNP get_physical_address
  33. externNP set_physical_address
  34. externNP get_rover_2
  35. ;-----------------------------------------------------------------------;
  36. ; Shrink ;
  37. ; ;
  38. ; This shrinks what's left of win.bin. The part at the front of win.bin;
  39. ; that has been loaded already is expendable. The part of win.bin ;
  40. ; that has not been loaded yet is moved down over the expended part. ;
  41. ; This does not change the segment that win.bin starts at. The ;
  42. ; partition is then realloced down in size. ;
  43. ; ;
  44. ; Arguments: ;
  45. ; none ;
  46. ; ;
  47. ; Returns: ;
  48. ; ;
  49. ; Error Returns: ;
  50. ; ;
  51. ; Registers Preserved: ;
  52. ; DI,SI,DS,ES ;
  53. ; ;
  54. ; Registers Destroyed: ;
  55. ; AX,BX,CX,DX ;
  56. ; ;
  57. ; Calls: ;
  58. ; BigMove ;
  59. ; GlobalReAlloc ;
  60. ; MyLock ;
  61. ; ;
  62. ; History: ;
  63. ; ;
  64. ; Fri Feb 27, 1987 01:20:57p -by- David N. Weise [davidw] ;
  65. ; Documented it and added this nifty comment block. ;
  66. ;-----------------------------------------------------------------------;
  67. assumes ds, nothing
  68. assumes es, nothing
  69. cProc Shrink,<PUBLIC,NEAR>
  70. cBegin nogen
  71. CheckKernelDS
  72. ReSetKernelDS
  73. push es
  74. push si
  75. push di
  76. mov ax,[segLoadBlock] ; Get current address
  77. mov bx, ax
  78. mov ds, pGlobalHeap
  79. UnSetKernelDS
  80. cCall get_arena_pointer32,<ax>
  81. mov edx, ds:[eax].pga_size
  82. shr edx, 4
  83. SetKernelDS
  84. mov ax,bx
  85. mov es,ax ; es is destination
  86. xor bx,bx
  87. xchg [cpShrink],bx ; Get amount to shrink by
  88. add [cpShrunk],bx ; Keep track of how much we have shrunk
  89. sub dx,bx ; get new size
  90. push dx ; save new size
  91. push ds ; save kernel ds
  92. mov ds, ax
  93. movzx esi, bx
  94. shl esi, 4 ; Start of new block
  95. xor edi, edi ; Where it will go
  96. movzx ecx, dx
  97. shl ecx, 2 ; Dwords
  98. cld ; Move it down.
  99. rep movs dword ptr es:[edi], dword ptr ds:[esi]
  100. db 67h ; 386 BUG, DO NOT REMOVE
  101. nop ; 386 BUG, DO NOT REMOVE
  102. pop ds
  103. CheckKernelDS
  104. ReSetKernelDS
  105. pop ax ; get back size in paragraphs
  106. mov cx,4
  107. xor dx,dx ; convert to bytes
  108. il3e:
  109. shl ax,1
  110. rcl dx,1
  111. loop il3e
  112. cCall GlobalReAlloc,<hLoadBlock,dxax,cx>
  113. cCall MyLock,<hLoadBlock>
  114. mov [segLoadBlock],ax
  115. pop di
  116. pop si
  117. pop es
  118. ret
  119. cEnd nogen
  120. sEnd INITCODE
  121. end