📄 smbrun.asm
字号:
;; pop bx
;; push cs
;; pop ds ; DS:BX = current structures end + 1
;; mov si,di
;; add di,cx ; DS:SI = start of data to be moved
;;; DS:SI = start of data to be moved
;;; DS:BX = end of data to be moved + 1
;;; ES:DI = start of destn
;;; DX = handle# of the structure to be deleted
;;; move up all the following structures and update the handles of all the
;;; following structures
;;rsss_c04_00:
;;; DS:SI = ptr to next structure to be moved
;;; DX = new handle# of the structure to be moved
;; mov ds:word ptr (DMIHDR_STRUC ptr [si]).wHandle,dx; update handle of next structure
;; inc dx ; update handle#
;; call GetStrucLen ; CX = length of structure to be moved
;; rep movs es:byte ptr [di],ds:byte ptr [si]; move the structure
;; cmp si,bx ; end of movement reached ?
;; jb short rsss_c04_00 ; not yet
;;; the concerned structure is deleted, all the following structures are moved up
;;; update necessary parameters
;; mov cx,cgroup:word ptr (SMB_INTERNAL_DATA_STRUC ptr smbios_internal_data).wSMBNumRuntimeStruc; #of valid runtime structures before deletion
;; dec cx
;; mov cgroup:word ptr (SMB_INTERNAL_DATA_STRUC ptr smbios_internal_data).wSMBNumRuntimeStruc,cx; #of valid runtime structures after deletion
;; mov si,offset cgroup:smbios_table_entry_point_struc; DS:SI = ptr to SMBIOS Table Entry
;;; DS:SI = ptr to SMBIOS Table Entry Point Structure
;; mov ds:word ptr (SMB_TABLE_HEADER_STRUC ptr [si]).wNumSMBStruc,cx; update total #of data structures
;; push si
;; mov si,cgroup:word ptr (SMB_INTERNAL_DATA_STRUC ptr smbios_internal_data).wSMBStructuresStart; DS:SI = ptr to start of structures
;; mov di,cgroup:word ptr (SMB_INTERNAL_DATA_STRUC ptr smbios_internal_data).wSMBCurrentStructuresEnd; DS:DI = ptr to end of structures
;; call get_smbios_structures_details ; AX = largest structure size
;; pop si
;;; DS:SI = ptr to SMBIOS Table Entry Point Structure
;; mov ds:word ptr (SMB_TABLE_HEADER_STRUC ptr [si]).wMaxStrucSize,ax; update largest structure size
;;; update the checksum in SMBIOS Table Entry Point
;; call update_ieps_checksum ; update checksum in IEPS
;; call update_eps_checksum ; update checksum in EPS
push bp
mov bp,offset cgroup:rsss_del_struc
call gen_smi_for_gpnv
pop bp
; <(CORE0221)
jmp rsss_06
;---------------------------------------;
rt_set_smbios_struc endp
; (CORE0221+)>
;---------------------------------------;
gen_smi_for_gpnv:
; check if SMI possible ?
push ds
push 0f000h
pop ds ; ds = 0f000h
; test cgroup:byte ptr _module_bit_map,gpc_bitm; gpc present ?
test byte ptr ds:[0f688h],gpc_bitm ; gpc present ?
jz gsfg_no_smi ; no..
; test cs:byte ptr bios_scratch,bios_post_complete_bit; POST/Runtime ?
test byte ptr ds:[0e2c1h],bios_post_complete_bit; POST/Runtime ?
jz gsfg_no_smi ; POST..
pop ds
; SMI possible..
db 9ah ; far call F000:EEE4
dw 0eee4h
dw 0f000h
gsfg_exit:
ret
gsfg_no_smi:
pop ds
push cs ; far call
call bp
jmp short gsfg_exit
;---------------------------------------;
rsss_prot_shadow:
mov bp,FLUSH_ALL_CACHE_FUNC ; flush all cache
call cgroup:dword ptr runtime_interface_routine
mov bp,F000_READ_RAM_WRITE_ROM_FUNC; F000 shadow Read Only
call cgroup:dword ptr runtime_interface_routine
ret ; NEAR return
;---------------------------------------;
rsss_write_shadow:
mov bp,F000_READ_X_WRITE_RAM_FUNC; F000 shadow Write enabled
call cgroup:dword ptr runtime_interface_routine
rep movs es:byte ptr [di],ds:byte ptr [si]; move the data to F000 Shadow
; (CORE0221) Make sure shadow accessing in one shot during SMM
call rsss_prot_shadow
retf
;---------------------------------------;
rsss_add_struc:
mov bp,F000_READ_X_WRITE_RAM_FUNC; F000 shadow Write enabled
call cgroup:dword ptr runtime_interface_routine
push cx
rep movs es:byte ptr [di],ds:byte ptr [si]; add the new structure to F000 Shadow
pop cx
; BX = #of valid runtime structures
; ES:DI = ptr to updated structures end + 1
; CX = new structure length in bytes
; update necessary parameters
mov cgroup:word ptr (SMB_INTERNAL_DATA_STRUC ptr smbios_internal_data).wSMBCurrentStructuresEnd,di; update ptr to current structures + 1
inc bx ; #of valid runtime structures
mov cgroup:word ptr (SMB_INTERNAL_DATA_STRUC ptr smbios_internal_data).wSMBNumRuntimeStruc,bx; update #of valid runtime structures
push cs
pop ds
mov si,offset cgroup:smbios_table_entry_point_struc; DS:SI = ptr to SMBIOS Table Entry
; DS:SI = ptr to SMBIOS Table Entry Point Structure
mov ds:word ptr (SMB_TABLE_HEADER_STRUC ptr [si]).wNumSMBStruc,cx; update total #of data structures
cmp cx,ds:word ptr (SMB_TABLE_HEADER_STRUC ptr [si]).wMaxStrucSize; max structure size changed ?
jbe short rsss_c03_01 ; max structure size does not change
mov ds:word ptr (SMB_TABLE_HEADER_STRUC ptr [si]).wMaxStrucSize,cx; update max structure size
rsss_c03_01:
; DS:SI = ptr to SMBIOS Table Entry Point Structure
; update the checksum in SMBIOS Table Entry Point
call update_ieps_checksum ; update checksum in IEPS
call update_eps_checksum ; update checksum in EPS
; (CORE0221) Make sure shadow accessing in one shot during SMM
call rsss_prot_shadow
retf
;---------------------------------------;
rsss_del_struc:
mov bp,F000_READ_X_WRITE_RAM_FUNC; F000 shadow Write enabled
call cgroup:dword ptr runtime_interface_routine
mov bx,cgroup:word ptr (SMB_INTERNAL_DATA_STRUC ptr smbios_internal_data).wSMBCurrentStructuresEnd; BX = ptr to current structures end + 1
push bx
sub bx,cx ; update current structures end + 1 after deletion
mov cgroup:word ptr (SMB_INTERNAL_DATA_STRUC ptr smbios_internal_data).wSMBCurrentStructuresEnd,di; update current structures end + 1
pop bx
push cs
pop ds ; DS:BX = current structures end + 1
mov si,di
add di,cx ; DS:SI = start of data to be moved
; DS:SI = start of data to be moved
; DS:BX = end of data to be moved + 1
; ES:DI = start of destn
; DX = handle# of the structure to be deleted
; move up all the following structures and update the handles of all the
; following structures
rsss_c04_00:
; DS:SI = ptr to next structure to be moved
; DX = new handle# of the structure to be moved
mov ds:word ptr (DMIHDR_STRUC ptr [si]).wHandle,dx; update handle of next structure
inc dx ; update handle#
call GetStrucLen ; CX = length of structure to be moved
rep movs es:byte ptr [di],ds:byte ptr [si]; move the structure
cmp si,bx ; end of movement reached ?
jb short rsss_c04_00 ; not yet
; the concerned structure is deleted, all the following structures are moved up
; update necessary parameters
mov cx,cgroup:word ptr (SMB_INTERNAL_DATA_STRUC ptr smbios_internal_data).wSMBNumRuntimeStruc; #of valid runtime structures before deletion
dec cx
mov cgroup:word ptr (SMB_INTERNAL_DATA_STRUC ptr smbios_internal_data).wSMBNumRuntimeStruc,cx; #of valid runtime structures after deletion
mov si,offset cgroup:smbios_table_entry_point_struc; DS:SI = ptr to SMBIOS Table Entry
; DS:SI = ptr to SMBIOS Table Entry Point Structure
mov ds:word ptr (SMB_TABLE_HEADER_STRUC ptr [si]).wNumSMBStruc,cx; update total #of data structures
push si
mov si,cgroup:word ptr (SMB_INTERNAL_DATA_STRUC ptr smbios_internal_data).wSMBStructuresStart; DS:SI = ptr to start of structures
mov di,cgroup:word ptr (SMB_INTERNAL_DATA_STRUC ptr smbios_internal_data).wSMBCurrentStructuresEnd; DS:DI = ptr to end of structures
call get_smbios_structures_details ; AX = largest structure size
pop si
; DS:SI = ptr to SMBIOS Table Entry Point Structure
mov ds:word ptr (SMB_TABLE_HEADER_STRUC ptr [si]).wMaxStrucSize,ax; update largest structure size
; update the checksum in SMBIOS Table Entry Point
call update_ieps_checksum ; update checksum in IEPS
call update_eps_checksum ; update checksum in EPS
; (CORE0221) Make sure shadow accessing in one shot during SMM
call rsss_prot_shadow
retf
; <(CORE0221+)
;-----------------------------------------------------------------------;
; Func 53h..RT_GET_SMBIOS_STRUC_CHANGE_INFO ;
;-----------------------------------------------------------------------;
; This function returns the information about what type of SMBIOS ;
; structure-change occurred. ;
; Input: [EBP+00] = Function number (53h) ;
; [EBP+02] = WORD FAR *DmiChangeStructure ;
; [EBP+06] = WORD DmiSelector ;
; [EBP+08] = WORD BiosSelector ;
; Output: AX = Zero if successful ;
; non-zero return code if unsuccessful ;
; Destroys: Nothing ;
;-----------------------------------------------------------------------;
rt_get_smbios_struc_change_info proc near
push es
push ds
push di
les di,dword ptr [ebp+02h] ; ES:DI = ptr to DMI Change Structure buffer
call get_ebda ; DS = EBDA
xor ax,ax
xchg ah,xdgroup:smbios_change_status; AH = SMBIOS Change Status
xchg al,xdgroup:smbios_change_type; AL = SMBIOS Change Type
mov es:byte ptr (SMBIOS_FUNC53_BUFFER_STRUC ptr [di]).bChangeStatus,ah
mov es:byte ptr (SMBIOS_FUNC53_BUFFER_STRUC ptr [di]).bChangeType,al
push ax
cmp ah,SMBIOS_MULTIPLE_STRUCTURE_AFFECTED
mov ax,0000h ; DO NOT USE xor ax,ax !!!!!!!!!!!!!!!!
; Flags has the information of prev CMP
xchg ax,xdgroup:smbios_change_handle; AX = handle# of changed structure
jnz short rgssci_00 ; single structure affected
xor ax,ax ; make handle# 00 for multiple structures change
rgssci_00:
mov es:word ptr (SMBIOS_FUNC53_BUFFER_STRUC ptr [di]).wChangeHandle,ax
pop ax ; AH, AL = change status, type
cmp ah,SMBIOS_NO_CHANGE ; any change in status ?
mov ax,RT_DMI_SUCCESS ; successful
jnz short rgssci_01 ; change in status
mov ax,RT_DMI_NO_CHANGE ; no change in status, return with error code
rgssci_01:
pop di
pop ds
pop es
ret
rt_get_smbios_struc_change_info endp
;-----------------------------------------------------------------------;
; Func 54h..RT_SMBIOS_CONTROL ;
;-----------------------------------------------------------------------;
; This function returns the information about what type of SMBIOS ;
; structure-change occurred. ;
; Input: [EBP+00] = Function number (54h) ;
; [EBP+02] = SubFunction ;
; [EBP+04] = WORD FAR *Data ;
; [EBP+08] = Control ;
; [EBP+0A] = WORD DmiSelector ;
; [EBP+0C] = WORD BiosSelector ;
; Output: AX = Zero if successful ;
; non-zero return code if unsuccessful ;
; Destroys: Nothing ;
;-----------------------------------------------------------------------;
rt_smbios_control:
; (CORE0218+)>
; mov ax,RT_PNP_UNSUPPORTED ;Return code for unsupported func
if MKF_EVENT_LOG
push ds
push es
pushad
test byte ptr [ebp+08h],01h ; Bit-0 = 0, validate parameter
; 1, Set structure immediately
jz short rsc_00 ; validate parameters (unsupport)
cmp byte ptr [EBP+02],02h
ja rsc_00
cmp byte ptr [EBP+02],01h ;DMI_CONTROL_LOGGING ?
jne rsc_02
les di,dword ptr [ebp+02h] ; ES:DI = ptr to Data
mov edx,dword ptr es:[di] ; get AND/OR value
mov cl,1 ;subfunction 1
call_special:
mov ax,'PB' ;special function
mov bx,'GV' ;special function
int 15h
popad
xor ax,ax ; successful
rsc_01:
pop es
pop ds
ret
rsc_02: ;DMI_CLEAR_EVENT
mov cl,2 ;subfunction 2
jmp call_special
jmp rsc_01
rsc_00:
popad
mov ax,RT_DMI_BAD_PARAMETER
jmp rsc_01
else
mov ax,RT_DMI_FUNCTION_NOT_SUPPORTED; error code for corrupted GPNV
ret
endif ;MKF_EVENT_LOG
; <(CORE0218+)
ret
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1999, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------------------------------;
public _SMBRUN_ENDS
_SMBRUN_ENDS label byte ; marks end of module
;---------------------------------------------------------------;
_text ends
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -