📄 npost.asm
字号:
; 1, do not check co-proc ;
; if (ZF) = 0 then init_after_finit will be called. ;
; register usage : can destroy any register except EBP,DS,ES,FS,GS ;
;-----------------------------------------------------------------------;
public init_before_finit
init_before_finit:
or sp,sp ; (ZF) = 0, test coproc
ret
;-----------------------------------------------------------------------;
; INIT_AFTER_FINIT ;
;-----------------------------------------------------------------------;
; check point : 9D ;
; after co-processor check, if any initializationis required. ;
; input : ;
; SS 0030H ;
; DS 0040H ;
; ES 0000H ;
; stack available ;
; register usage : can destroy any register except EBP,DS,ES,FS,GS ;
;-----------------------------------------------------------------------;
public init_after_finit
init_after_finit:
ret
;-----------------------------------------------------------------------;
; POST_DIAG_LOOP ;
;-----------------------------------------------------------------------;
; check point : A2 ;
; if diag switch is on, this routine gets control after soft error ;
; messages are displayed. do any special operation, then give control ;
; to begining of diagnostics. ;
; input : ;
; SS 0030H ;
; DS 0040H ;
; ES 0000H ;
; stack available ;
; register usage : can destroy any register except EBP,DS,ES,FS,GS ;
;-----------------------------------------------------------------------;
public post_diag_loop
post_diag_loop:
jmp reset_e05b
;-----------------------------------------------------------------------;
; E000_CONTROL_BEFORE ; Moved to OEMPOST.ASM
;-----------------------------------------------------------------------;
; E000_CONTROL_AFTER ; Moved to OEMPOST.ASM
;-----------------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;-----------------------------------------------------------------------;
; GET_SHADOW_STATUS ; Moved to OEMPOST.ASM
;-----------------------------------------------------------------------;
; GET_POST_INFO ; Moved to OEMPOST.ASM ;
;-----------------------------------------------------------------------;
; CHECK_POST_RAM ;
;-----------------------------------------------------------------------;
; this routine makes code segment of POST write enabled. ;
; input : ;
; none ;
; output: ;
; none ;
; register usage : can destroy any register except EBP,DS,ES,FS,GS ;
;-----------------------------------------------------------------------;
extrn get_shadow_status:near
extrn e000_read_x_write_ram:near
extrn f000_read_x_write_ram:near
extrn copy_control_to_ram:near
public check_post_ram
check_post_ram:
call get_shadow_status ; F000 R/W possible
jc cpr_00 ; no
test di,01h ; shadow R/W possible ?
jz cpr_00 ; no
test cs:bios_scratch,02h ; E000 shadow enabled ?
jz cpr_02 ; yes..no need for E000
call e000_read_x_write_ram ; make E000 write enabled
cpr_02:
call f000_read_x_write_ram ; make F000 write enabled
cpr_01:
ret
cpr_00:
; shadow R/W not possible..
; execute POST from RAM..
call copy_control_to_ram ; copy and give control in RAM
ret
;-----------------------------------------------------------------------;
; RESTORE_SHADOW_AFTER_POST ;
;-----------------------------------------------------------------------;
; this routine restores shadow rams after POST is executed from RAM. ;
; input : ;
; none ;
; output: ;
; none ;
; register usage : can destroy any register except EBP,DS,ES,FS,GS ;
;-----------------------------------------------------------------------;
extrn e000_read_ram_write_rom:near
extrn f000_read_ram_write_rom:near
extrn copy_control_to_shadow:near
public restore_shadow_after_post
restore_shadow_after_post:
mov ax,cs
cmp ax,0f000h ; POST from F000 ?
jnz rsap_00 ; no
test cs:bios_scratch,02h ; E000 shadow enabled ?
jz rsap_02 ; yes..no need for E000
call e000_read_ram_write_rom ; make E000 write protected
rsap_02:
call f000_read_ram_write_rom ; make F000 write protected
ret
rsap_00:
; copy current POST code segment to F000 RAM..
push es
push ds
push 0f000h
pop es
xor di,di ; ES:DI = destn
push cs
pop ds
xor si,si ; DS:SI = source
xor cx,cx ; 64kbytes copy
call copy_control_to_shadow ; copy and xfer control to F000 shadow
pop ds
pop es
ret
;-----------------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;-----------------------------------------------------------------------;
; FORM_E820_TABLE ;
;-----------------------------------------------------------------------;
; this routine forms the information tables for INT-15 E820 function. ;
; input : ;
; CS is writable ;
; DS 0040h ;
; ES 0000h ;
; stack available ;
; output: ;
; table formed ;
; register destroyed : NONE ;
; NOTE : 1. do not assume CS to be F000. ;
;-----------------------------------------------------------------------;
extrn read_cmos_word:near
extrn e820_info_table:byte
extrn get_cmos_item:near
form_e820_table proc near
push es
push ds
pushad
pushf
cli
; this code will update the table in shadow ram value with the proper
; extended memory size information for INT-15 Func E820H.
call get_memory_info
jc f_e820_exit ; routine not implemented
mov ebp,esi
; EBP = total memory memory size in bytes
; ECX, EDX = memory region1 32-bit start address, size in bytes
; EAX, EBX = memory region2 32-bit start address, size in bytes
; DI bit-0 = 0..memory region1 is a HOLE region
; 1..memory region1 is a non-cacheable region
; bit-1 = 0..memory region2 is a HOLE region
; 1..memory region2 is a non-cacheable region
; bit15-2....unused (set to 0)
shr di,1 ; region1 is a hole ?
jnc f_e820_100 ; yes
xor ecx,ecx ; force hole1 does not exist
xor edx,edx
f_e820_100:
shr di,1 ; region2 is a hole ?
jnc f_e820_101 ; yes
xor eax,eax ; force hole2 does not exist
xor ebx,ebx
f_e820_101:
push ax
mov ax,9596h ; cmos reg 16h(H), 15h(L)
call read_cmos_word
movzx esi,ax
pop ax
shl esi,0ah ; base memory in bytes
push ds
pop es ; ES = 0040h..BIOS data segment
; ES = BIOS data segment 0040h..
push cs
pop ds ; DS = CS
; ESI = base memory size in bytes
; EBP = total memory memory size in bytes
; ECX, EDX = memory hole1 32-bit start address, size in bytes
; EAX, EBX = memory hole2 32-bit start address, size in bytes
; form the information the E820_INFO_TABLE..
; the table is already initialzed with 00..
mov di,offset cgroup:e820_info_table
push eax
push bx
; base memory information..
test es:sys_info,80h ; EBDA allocated ?
pushf
jz f_e820_00 ; no EBDA
sub esi,00000400h ; base memory size reduced by 1K (size of EBDA)
f_e820_00:
xor eax,eax ; base memory 32-bit start addr
mov bl,ram_os
call fill_e820_info ; fill info and update ptr and
; update max cont value
popf
jz f_e820_01 ; no EBDA
; extended BIOS data area (EBDA) information..
mov eax,esi ; EBDA 32-bit start address
mov esi,00000400h ; EBDA size in bytes (1Kbytes)
mov bl,ram_res ; indicate reserved RAM
call fill_e820_info ; fill info and update ptr and
; update max cont value
f_e820_01:
mov al,Q_USB_FUNCTION_ENABLE
call get_cmos_item
jz check_usb_keyboard_done
mov al,Q_USB_LEGACY_ENABLE
call get_cmos_item
jz check_usb_keyboard_done
mov eax,000dc000h ; system BIOS 32-bit start address
mov esi,00004000h ; system BIOS size in bytes
mov bl,ram_res ; indicate reserved RAM
call fill_e820_info ; fill info and update ptr and
check_usb_keyboard_done:
; system BIOS information..
mov eax,000f0000h ; 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
; extended memory information..
mov ax,0b5b6h
call read_cmos_word ; AX = ext mem size in 64K chunks
shl eax,10h ; EAX = ext mem size in bytes
mov esi,eax ; ext mem size in bytes
;---------------------------------------;
if MKF_ACPI_SUPPORT ; ACPI SUPPORT
%out Modified code for E820, in NPOST.ASM
test cgroup:bios_scratch,acpi_aware_os_bit; ACPI OS ?
pushf
jz short f_e820_07 ; no
sub esi,(64*1024) ; Base address = TOM-64KB
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -