📄 npost.asm
字号:
f_e820_07:
mov eax,00100000h ; ext memory 32-bit start address
mov bl,ram_os ; indicate RAM available to OS
call fill_e820_info ; fill info and update ptr and
; update max cont value
popf ; ACPI OS ?
pop bx
pop eax
jz short f_e820_08 ; not ACPI OS
push eax
push bx ; (CORE0226+)
push esi
mov eax,ebp
sub eax,(64*1024) ; Base address = TOM-64KB
mov esi,00008000h ; 64KB in size
mov bl,ram_acpi_data
call fill_e820_info ; fill info and update ptr and
mov eax,ebp ; Get Top of memory
sub eax,(32*1024) ; Base address = TOM-64KB
mov esi,00008000h ; 64KB in size
mov bl,ram_acpi_nvs
call fill_e820_info ; fill info and update ptr and
pop esi
pop bx ; (CORE0226+)
pop eax
f_e820_08:
;;>>
sub ebp,(64*1024) ; Base address = TOM-64KB
;;<<
else ; NO ACPI SUPPORT
mov eax,00100000h ; ext memory 32-bit start address
mov bl,ram_os ; indicate RAM available to OS
call fill_e820_info ; fill info and update ptr and
; update max cont value
pop bx
pop eax
endif
;---------------------------------------;
; EBP = total memory memory size in bytes
; ECX, EDX = memory hole1 32-bit start address, memory hole1 size in bytes
; EAX, EBX = memory hole2 32-bit start address, memory hole2 size in bytes
; make sure that ECX, EDX has the lower hole information..
push ebx
or ebx,edx
pop ebx
jz f_e820_02 ; all holes disabled
cmp ecx,eax
jb f_e820_03 ; hole1 at lower address than hole2
; hole2 is at lower address than hole1..
xchg ecx,eax ; exchange start address info
xchg edx,ebx ; exchange size info
f_e820_03:
; memory hole1 is at lower address now..
; ECX, EDX = memory hole1 32-bit start address, memory hole1 size in bytes
; EAX, EBX = memory hole2 32-bit start address, memory hole2 size in bytes
or edx,edx ; hole1 exists ?
jnz f_e820_02 ; no
mov ecx,eax ; put hole2 as hole1
mov edx,ebx
xor eax,eax ; make hole2 not exist
xor ebx,ebx
f_e820_02:
; EBP = total memory memory size in bytes
; ECX, EDX = 32-bit start address, size in bytes of the memory hole at lower address
; EAX, EBX = 32-bit start address, size in bytes of the other memory hole
jecxz f_e820_04 ; no memory hole
; fill hole1 data structure..
push eax
push bx
mov eax,ecx ; memory hole1 32-bit start address
mov esi,edx ; memory hole1 size in bytes
mov bl,ram_res ; indicate reserved RAM
call fill_e820_info ; fill info and update ptr and
; update max cont value
pop bx
pop eax
or ebx,ebx ; hole2 present ?
jz f_e820_05 ; no
; hole2 present, check whether hole1 is below 1MB..if yes, do not fill
; above hole1 information..
cmp ecx,100000h ; hole1 at below 1MB ?
jb f_e820_06 ; yes
; fill abobe hole1 information..
push eax
push bx
add ecx,edx ; ecx = 32-bit start address above hole1
mov esi,eax ; hole2 32-bit start address
mov eax,ecx ; 32-bit start address above hole1
sub esi,ecx ; size = hole2 start - (hole1 start + hole1 size)
; ESI = above hole1 size in bytes
mov bl,ram_os ; indicate RAM available to OS
call fill_e820_info ; fill info and update ptr and
; update max cont value
pop bx
pop eax
f_e820_06:
; fill hole2 information..
; EAX = hole2 32-bit start address
push bx
mov esi,ebx ; hole2 size in bytes
mov bl,ram_res ; indicate reserved RAM
call fill_e820_info ; fill info and update ptr and
; update max cont value
pop bx
cmp eax,100000h ; hole2 at below 1MB ?
jb f_e820_04 ; yes
; fill above hole2 information..
add eax,ebx ; EAX = 32-bit start address above hole2
; EBP = total memory size in bytes..
sub ebp,eax ; size = (tot. memory onboard) - (above hole2 start)
jz f_e820_04 ; exit
; EXA = 32-bit start address above hole2
mov esi,ebp ; above hole2 size in bytes
mov bl,ram_os ; indicate RAM available to OS
call fill_e820_info ; fill info and update ptr and
; update max cont value
jmp short f_e820_04 ; exit
f_e820_05:
cmp ecx,100000h ; hole1 at below 1MB ?
jb f_e820_04 ; yes
; fill above hole 1 data structure..
add ecx,edx
; EBP = total memory size in bytes..
sub ebp,ecx ; size = total memory onboard - above hole start
jz f_e820_04
mov eax,ecx ; above hole start addresss
mov esi,ebp ; above hole size
mov bl,ram_os ; indicate RAM available to OS
call fill_e820_info ; fill info and update ptr and
; update max cont value
f_e820_04:
if (MKF_NCPU eq 2)
; fill I/O APIC memory..
mov eax,0fec00000h ; I/O APIC memory mapped 32-bit start address
mov esi,00001000h ; I/O APIC memory mapped space size in bytes
mov bl,ram_res ; indicate reserved RAM
call fill_e820_info ; fill info and update ptr and
; update max cont value
; fill Local APIC memory..
mov eax,0fee00000h ; Local APIC memory mapped 32-bit start address
mov esi,00001000h ; Local APIC memory mapped space size in bytes
mov bl,ram_res ; indicate reserved RAM
call fill_e820_info ; fill info and update ptr and
; update max cont value
endif
; Unknow Memory ??
mov eax,0ffef0000h ; remapped system BIOS 32-bit start address
mov esi,00010000h ; system BIOS size in bytes
mov bl,ram_res ; indicate reserved RAM
call fill_e820_info ; fill info and update ptr and
; update max cont value
; fill system BIOS information below 4GB..
mov eax,0ffff0000h ; remapped system BIOS 32-bit start address
mov esi,00010000h ; system BIOS size in bytes
mov bl,ram_res ; indicate reserved RAM
call fill_e820_info ; fill info and update ptr and
; update max cont value
f_e820_exit:
popf
popad
pop ds
pop es
ret
form_e820_table endp
;-----------------------------------------------------------------------;
; FILL_E820_INFO ;
;-----------------------------------------------------------------------;
; input : ;
; EAX start address ;
; ESI size in bytes ;
; BL memory type ;
; DS:DI ptr to entry ;
; output: ;
; DS:DI ptr to next entry ;
; NOTE: this routine also updates the max continuation value. ;
;-----------------------------------------------------------------------;
extrn e820_max_cont_value:byte
fill_e820_info proc near
mov dword ptr [di],eax ; start address
mov dword ptr [di+04h],esi ; size
mov byte ptr [di+08h],bl ; memory type
add di,size e820_info_struc ; ptr to next entry
inc dword ptr e820_max_cont_value; update cont value
ret
fill_e820_info endp
;-----------------------------------------------------------------------;
; GET_MEMORY_INFO ;
;-----------------------------------------------------------------------;
; check point : 8C ;
; this routine is called while generating table for INT-15 E820 func. ;
; input : ;
; SS 0030H ;
; DS 0040H ;
; ES 0000H ;
; stack available ;
; output: ;
; cy routine not implemented ;
; nc routine implemented ;
; ESI total memory size in bytes ;
; (example, for 8MB total memory, ESI = 8192*1024bytes) ;
; ECX,EDX memory region1 32-bit start address, size in bytes ;
; EAX,EBX memory region2 32-bit start address, size in bytes ;
; EDI bit-0 = Memory region1 information ;
; 0..memory region1 is a HOLE region ;
; 1..memory region1 is a non-cacheable region ;
; bit-1 = Memory region2 information ;
; 0..memory region2 is a HOLE region ;
; 1..memory region2 is a non-cacheable region ;
; bit-2 = Reserved ;
; bit-3 = 0 -> rest of memory L1 write-through ;
; 1 -> rest of memory L1 write-back ;
; bit-31..4 = Reserved ;
; register usage : can destroy any register except EBP,DS,ES,FS,GS ;
; NOTE: 1. Set both start address and size to 0000 for a region which ;
; does not exist. ;
; 2. This routine should read the chipset registers to return the ;
; parameters (this parameters MUST NOT BE READ FROM CMOS). ;
;-----------------------------------------------------------------------;
public get_memory_info
extrn get_mem_info:near
get_memory_info:
call get_mem_info ; get all except bit-3 of (EDI)
jc getout
push ax
mov al,q_internal_cache
call check_cmos_data
and ax,3 ; 00,01,10,11 = dis,WT,WB,Reserved
jz getout1
shl al,2 ; bit-3 = 0/1 = WT/WB
getout1:
or di,ax ; (set DI and NC)
pop ax
getout:
ret
;-----------------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;-----------------------------------------------------------------------;
if MKF_EVENT_LOG ; (CORE0218+)>
include event.inc
endif ;MKF_EVENT_LOG ; <(CORE0218+)
public _NPOST_ENDS
_NPOST_ENDS label byte ; marks end of module
;---------------------------------------;
_text ends
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -