mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 06:16:38 +00:00
begin implementation of memory detection
svn path=/trunk/; revision=1471
This commit is contained in:
parent
c6010e401e
commit
90beca63cb
3 changed files with 64 additions and 3 deletions
|
@ -269,6 +269,52 @@ entry:
|
||||||
mov [_multiboot_mods_addr], eax
|
mov [_multiboot_mods_addr], eax
|
||||||
add dword [_multiboot_mods_addr], _multiboot_modules
|
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
|
;; Begin the pmode initalization
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -410,6 +410,12 @@ void _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
|
||||||
KeInit1();
|
KeInit1();
|
||||||
KeLowerIrql(DISPATCH_LEVEL);
|
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
|
* Display version number and copyright/warranty message
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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
|
* COPYRIGHT: See COPYING in the top directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -217,10 +217,19 @@ VOID MmInit1(ULONG FirstKrnlPhysAddr,
|
||||||
/*
|
/*
|
||||||
* Free physical memory not used by the kernel
|
* 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(
|
LastKernelAddress = (ULONG)MmInitializePageList(
|
||||||
(PVOID)FirstKrnlPhysAddr,
|
(PVOID)FirstKrnlPhysAddr,
|
||||||
(PVOID)LastKrnlPhysAddr,
|
(PVOID)LastKrnlPhysAddr,
|
||||||
1024,
|
// 1024,
|
||||||
|
MmStats.NrTotalPages ,
|
||||||
PAGE_ROUND_UP(LastKernelAddress));
|
PAGE_ROUND_UP(LastKernelAddress));
|
||||||
kernel_len = LastKrnlPhysAddr - FirstKrnlPhysAddr;
|
kernel_len = LastKrnlPhysAddr - FirstKrnlPhysAddr;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue