diff --git a/reactos/loaders/dos/loadros.asm b/reactos/loaders/dos/loadros.asm index 40f4b3fac87..4131d9dc353 100644 --- a/reactos/loaders/dos/loadros.asm +++ b/reactos/loaders/dos/loadros.asm @@ -269,6 +269,52 @@ entry: mov [_multiboot_mods_addr], eax add dword [_multiboot_mods_addr], _multiboot_modules + ;; + ;; get extended memory size in KB + ;; + + push ebx + xor ebx,ebx + mov [_multiboot_mem_lower],ebx + mov ax, 0xe801 + int 015h + cmp ebx,ebx + jz .oldstylemem + + and ebx, 0xffff + shl ebx,6 + mov [_multiboot_mem_lower],ebx + and eax,0xffff + add dword [_multiboot_mem_lower],eax + jmp .done_mem + +.oldstylemem: + ;; int 15h opt e801 don't work , try int 15h, option 88h + mov ah, 088h + int 015h + cmp ax,ax + jz .cmosmem + mov [_multiboot_mem_lower],ax + jmp .done_mem +.cmosmem: + ;; int 15h opt 88h don't work , try read cmos + xor eax,eax + mov al, 0x31 + out 0x70, al + in al, 0x71 + and eax, 0xffff ; clear carry + shl eax,8 + mov [_multiboot_mem_lower],eax +;; xor eax,eax +;; mov al, 0x30 +;; out 0x70, al +;; in al, 0x71 +;; and eax, 0xffff ; clear carry +;; add [_multiboot_mem_lower],eax + +.done_mem: + pop ebx + ;; ;; Begin the pmode initalization ;; diff --git a/reactos/ntoskrnl/ke/main.c b/reactos/ntoskrnl/ke/main.c index 7ec915e463b..9595d0baf53 100644 --- a/reactos/ntoskrnl/ke/main.c +++ b/reactos/ntoskrnl/ke/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.66 2000/10/22 16:36:50 ekohl Exp $ +/* $Id: main.c,v 1.67 2000/12/20 18:43:13 jean Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -410,6 +410,12 @@ void _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock) KeInit1(); KeLowerIrql(DISPATCH_LEVEL); + { + char tmpbuf[80]; + sprintf(tmpbuf,"system with %d MB extended memory\n" + ,(unsigned int)(KeLoaderBlock.MemLower)/1024); + HalDisplayString(tmpbuf); + } /* * Display version number and copyright/warranty message */ diff --git a/reactos/ntoskrnl/mm/mminit.c b/reactos/ntoskrnl/mm/mminit.c index 488d88eefc7..903bc45cca2 100644 --- a/reactos/ntoskrnl/mm/mminit.c +++ b/reactos/ntoskrnl/mm/mminit.c @@ -1,4 +1,4 @@ -/* $Id: mminit.c,v 1.10 2000/10/22 16:36:52 ekohl Exp $ +/* $Id: mminit.c,v 1.11 2000/12/20 18:44:20 jean Exp $ * * COPYRIGHT: See COPYING in the top directory * PROJECT: ReactOS kernel @@ -217,10 +217,19 @@ VOID MmInit1(ULONG FirstKrnlPhysAddr, /* * Free physical memory not used by the kernel */ + MmStats.NrTotalPages = KeLoaderBlock.MemLower/4; + if ( !MmStats.NrTotalPages ) + { + DbgPrint("Memory not detected, default to 8 MB\n"); + MmStats.NrTotalPages = 2048; + } + else + MmStats.NrTotalPages += 256;// add 1MB for standard memory (not extended) LastKernelAddress = (ULONG)MmInitializePageList( (PVOID)FirstKrnlPhysAddr, (PVOID)LastKrnlPhysAddr, - 1024, +// 1024, + MmStats.NrTotalPages , PAGE_ROUND_UP(LastKernelAddress)); kernel_len = LastKrnlPhysAddr - FirstKrnlPhysAddr;