📄 smb_fcn.asm
字号:
push offset ds:MSG_HANDLE ; ...
push lpOutput ; ... ptr to output routine
call RPRINTF16 ; Rprintf it, return with AX = # chars printed
add sp,4+4+2 ; Strip arguments from stack
clc ; Mark as successful
popa ; Restore
lclEPILOG SMB_STR ; Strip local vars and return
assume ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing
SMB_HANDLE endp ; End SMB_HANDLE procedure
NPPROC SMB_HANDLEUNK -- Display A Handle w/Unknown
assume ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|
Display a Handle w/Unknown from FS.
On entry:
FS = Struc Segment
SS:BP ==> SMB_STR (after lclPROLOG)
On exit:
CF = 0 if successful
= 1 if not
|
lclPROLOG SMB_STR ; Address local vars
pusha ; Save all GP registers
; Display the leading text, unless asked not to
test LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
jnz short @F ; Jump if so
push ds ; Pass ptr to string
push [bp].SMBarg.argSMB_TEXT ; ...
call DispASCIIZ ; Display ASCIIZ string
@@:
mov di,[bp].SMBarg.argSMB_START ; Get struc start
mov bx,[bp].SMBarg.argSMB_OFFS ; ... offset
mov ax,fs:[bx+di].ELO ; Get the hex word
cmp ax,[bp].SMBarg.argSMB_SPC2.EDQLO.ELO ; Izit unknown value?
jne short @F ; Jump if not
push ds ; Pass ptr to string
push offset ds:MSG_UNK_VAL ; ...
call DispASCIIZ ; Display ASCIIZ string
jmp short SMB_HANDLEUNK_EXIT ; Join common exit code
@@:
push ax ; Pass the hex word
push ds ; ... ptr to format string
push offset ds:MSG_HANDLE ; ...
push lpOutput ; ... ptr to output routine
call RPRINTF16 ; Rprintf it, return with AX = # chars printed
add sp,4+4+2 ; Strip arguments from stack
SMB_HANDLEUNK_EXIT:
clc ; Mark as successful
popa ; Restore
lclEPILOG SMB_STR ; Strip local vars and return
assume ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing
SMB_HANDLEUNK endp ; End SMB_HANDLEUNK procedure
NPPROC SMB_HANDLEUNK2 -- Display A Handle w/Unknown #2
assume ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|
Display a Handle w/Unknown #2 from FS.
On entry:
FS = Struc Segment
SS:BP ==> SMB_STR (after lclPROLOG)
On exit:
CF = 0 if successful
= 1 if not
|
lclPROLOG SMB_STR ; Address local vars
pusha ; Save all GP registers
; Display the leading text, unless asked not to
test LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
jnz short @F ; Jump if so
push ds ; Pass ptr to string
push [bp].SMBarg.argSMB_TEXT ; ...
call DispASCIIZ ; Display ASCIIZ string
@@:
mov di,[bp].SMBarg.argSMB_START ; Get struc start
mov bx,[bp].SMBarg.argSMB_OFFS ; ... offset
mov ax,fs:[bx+di].ELO ; Get the hex word
cmp ax,[bp].SMBarg.argSMB_SPC2.EDQLO.ELO ; Izit unknown value #1?
jne short @F ; Jump if not
push ds ; Pass ptr to string
push offset ds:MSG_UNK2A_VAL ; ...
call DispASCIIZ ; Display ASCIIZ string
jmp short SMB_HANDLEUNK2_EXIT ; Join common exit code
@@:
cmp ax,[bp].SMBarg.argSMB_SPC2.EDQLO.EHI ; Izit unknown value #2?
jne short @F ; Jump if not
push ds ; Pass ptr to string
push offset ds:MSG_UNK2B_VAL ; ...
call DispASCIIZ ; Display ASCIIZ string
jmp short SMB_HANDLEUNK2_EXIT ; Join common exit code
@@:
push ax ; Pass the hex word
push ds ; ... ptr to format string
push offset ds:MSG_HANDLE ; ...
push lpOutput ; ... ptr to output routine
call RPRINTF16 ; Rprintf it, return with AX = # chars printed
add sp,4+4+2 ; Strip arguments from stack
SMB_HANDLEUNK2_EXIT:
clc ; Mark as successful
popa ; Restore
lclEPILOG SMB_STR ; Strip local vars and return
assume ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing
SMB_HANDLEUNK2 endp ; End SMB_HANDLEUNK2 procedure
NPPROC SMB_RPTSTR -- Display Repeated Structure
assume ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|
Display repeated structure
On entry:
FS = Struc Segment
SS:BP ==> SMB_STR (after lclPROLOG)
On exit:
CF = 0 if successful
= 1 if not
|
lclPROLOG SMB_STR ; Address local vars
pusha ; Save registers
xor ax,ax ; In case we're to skip leading text
test LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
jnz short @F ; Jump if so
push ds ; Pass ptr to string
push [bp].SMBarg.argSMB_TEXT ; ...
call StrLen ; Return with string length in AX
@@:
mov [bp].SMBlcl.lclSMB_IND,ax ; Save for later use
; Calc the length of the strucs,
; add in the current offset to each item in the SMBnITEMs, and
; save the old value on the stack
mov ax,[bp].SMBarg.argSMB_OFFS ; Get struc offset
mov bx,[bp].SMBarg.argSMB_SPC1 ; ... offset in DGROUP of SMBnnITEMs
xor di,di ; Initialize index into SMBnnITEM strucs
xor dx,dx ; ... length of preceding ITEM_STR
@@:
cmp ds:[bx+di].ITEM_OFFS,-1 ; Izit the end?
je short @F ; Jump if so
push ds:[bx+di].ITEM_OFFS ; Save to restore later
mov ds:[bx+di].ITEM_OFFS,ax ; Save current offset
add ds:[bx+di].ITEM_OFFS,dx ; Add length of preceding ITEM_STR
add ax,dx ; Add in preceding length
mov dx,ds:[bx+di].ITEM_LEN ; Save as next length
add di,type ITEM_STR ; Skip to next ITEM_STR
jmp short @B ; Go around again
@@:
mov [bp].SMBlcl.lclSMB_ILEN,di ; Save as length of ITEM_STRs
; Get actual data length of strucs
mov si,[bp].SMBarg.argSMB_START ; Get struc start
mov bx,[bp].SMBarg.argSMB_SPC2.EDQLO.EHI ; ... offset in FS:SI of struc len
; If the offset is < 0, the value is the negative of an absolute length
cmp bx,0 ; Izit negative?
jl short SMB_RPTSTR1A ; Jump if so
movzx bx,fs:[bx+si].LO ; Get the actual struc length (zero to use as word)
jmp short SMB_RPTSTR1B ; Join common code
SMB_RPTSTR1A:
neg bx ; Negate to get absolute value
SMB_RPTSTR1B:
mov [bp].SMBlcl.lclSMB_SLEN,bx ; Save as actual data struc length
mov si,[bp].SMBarg.argSMB_START ; Get struc start
mov bx,[bp].SMBarg.argSMB_SPC2.EDQLO.ELO ; ... offset in FS:SI of # following strucs (as a byte)
; If the offset is -1, the struc repeats for the rest of the record
cmp bx,-1 ; Izit repeated to end-of-record?
je short SMB_RPTSTR2A ; Jump if so
movzx cx,fs:[bx+si].LO ; Get the struc count (zero to use as word)
jmp short SMB_RPTSTR2B ; Join common code
SMB_RPTSTR2A:
movzx ax,fs:[si].SMBHDR_LEN ; Get length byte, zero to use as word
sub ax,[bp].SMBarg.argSMB_OFFS ; Less struc offset
xor dx,dx ; Zero to use DX:AX as dword
div [bp].SMBlcl.lclSMB_SLEN ; Divide by length of items in struc
mov cx,ax ; Copy quotient as repeat count
SMB_RPTSTR2B:
movzx ax,fs:[si].SMBHDR_LEN ; Get length byte, zero to use as word
mov bx,[bp].SMBarg.argSMB_SPC1 ; Get offset in DGROUP of SMBnnITEMs
mov dx,[bp].SMBlcl.lclSMB_SLEN ; Get actual data length
SMB_RPTSTR_NEXT_STR:
mov [bp].SMBlcl.lclSMB_CNT,0 ; Mark as first time
xor di,di ; Initialize index into SMBnnITEM strucs
SMB_RPTSTR_NEXT_ITEM:
cmp ds:[bx+di].ITEM_OFFS,-1 ; Izit the end?
je short SMB_RPTSTR_LOOP ; Jump if so
cmp ax,ds:[bx+di].ITEM_OFFS ; Izit out of range?
jbe short SMB_RPTSTR_LOOP ; Jump if so
; Skip indent if not first time
test LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
jnz short SMB_RPTSTR3B ; Jump if so
cmp [bp].SMBlcl.lclSMB_CNT,0 ; Izit first time?
je short SMB_RPTSTR3A ; Jump if so
push [bp].SMBlcl.lclSMB_IND ; Pass indent
push [bp].SMBlcl.lclSMB_CNT ; ... count
call SkipIndent ; Skip over char indent unless first time
jmp short SMB_RPTSTR3B ; Join common code
SMB_RPTSTR3A:
push ds ; Pass ptr to string
push [bp].SMBarg.argSMB_TEXT ; ...
call DispASCIIZ ; Display ASCIIZ string
SMB_RPTSTR3B:
call SMB_ITEM_DATA ; Display SMB item data using
; DS:BX ==> SMBnnITEMs
; SI = struc start
; DI = index into SMBnnITEM strucs
jc short SMB_RPTSTR_EXIT ; Jump if something went wrong (note CF=1)
add ds:[bx+di].ITEM_OFFS,dx ; Skip to the next set of strucs
add di,type ITEM_STR ; Skip to next ITEM_STR
inc [bp].SMBlcl.lclSMB_CNT ; Count in another item
jmp SMB_RPTSTR_NEXT_ITEM ; Go around again
SMB_RPTSTR_LOOP:
loop SMB_RPTSTR_NEXT_STR ; Jump if more strucs
; In case there are ITEM_STRs following this set,
; we must fix their ITEM_OFFS by saving into each
; the current offset plus the length of the preceding ITEM
mov bx,[bp].SMBarg.argSMB_SPC1 ; Get offset in DGROUP of SMBnnITEMs
mov si,[bp].SMBlcl.lclSMB_ILEN ; Get length of ITEM_STRs
mov bx,ds:[bx+si-(type ITEM_STR)].ITEM_OFFS ; Get last struc offset
mov si,[bp].SMBarg.argSMB_ITEMO ; Get offset of this SMBnnITEM
xor ax,ax ; Initialize preceding item length
@@:
add si,type ITEM_STR ; Skip over this ITEM_STR
cmp ds:[si].ITEM_OFFS,-1 ; Izit the end?
je short @F ; Jump if so
mov ds:[si].ITEM_OFFS,bx ; Save as new struc offset
add bx,ax ; Skip over it
mov ax,ds:[si].ITEM_LEN ; Get length of this item
jmp short @B ; Go around again
@@:
clc ; Mark as successful
SMB_RPTSTR_EXIT:
lahf ; AH <-- FL (CF in particular)
; Restore the original SMBnnITEM offsets
mov bx,[bp].SMBarg.argSMB_SPC1 ; Get offset in DGROUP of SMBnnITEMs
mov di,[bp].SMBlcl.lclSMB_ILEN ; Get length of ITEM_STRs
@@:
sub di,type ITEM_STR ; Skip to previous ITEM_STR
jb short @F ; Jump if no more
pop ds:[bx+di].ITEM_OFFS ; Save to restore later
jmp short @B ; Go around again
@@:
sahf ; FL <-- AH
popa ; Restore
lclEPILOG SMB_STR ; Strip local vars and return
assume ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing
SMB_RPTSTR endp ; End SMB_RPTSTR procedure
NPPROC SMB_CETYPE -- Display Contained Element Type
assume ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|
Display Contained Element Type from FS.
On entry:
FS = Struc Segment
SS:BP ==> SMB_STR (after lclPROLOG)
On exit:
CF = 0 if successful
= 1 if not
|
lclPROLOG SMB_STR ; Address local vars
pusha ; Save all GP registers
; Display the leading text, unless asked not to
test LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
jnz short @F ; Jump if so
push ds ; Pass ptr to string
push [bp].SMBarg.argSMB_TEXT ; ...
call DispASCIIZ ; Display ASCIIZ string
@@:
mov di,[bp].SMBarg.argSMB_START ; Get struc start
mov bx,[bp].SMBarg.argSMB_OFFS ; ... offset
movzx ax,fs:[bx+di].LO ; Get bit field
btr ax,$SMB_CE_TYPE_SEL ; Test and clear the Selection bit
lea bx,SMBTYPE_ENUM ; Assume it's an SMBIOS Struc Type enum
jc short @F ; Jump if it's an SMBIOS Struc Type enum
; (i.e., @SMB_xxx)
; Fall through if it's a Base Board Type enum
; (i.e., @SMB2_TYPE_xxx)
lea bx,SMB2_TYPE_ENUM ; DS:BX ==> ENUM_STRs
@@:
call DispEnum ; Display enumerated value AX in DS:BX ==> ENUM_STRs
clc ; Mark as successful
popa ; Restore
lclEPILOG SMB_STR ; Strip local vars and return
assume ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing
SMB_CETYPE endp ; End SMB_CETYPE procedure
NPPROC SMB_PTR16 -- Display A 16-Bit Pointer
assume ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|
Display a 16-bit pointer from FS.
On entry:
FS = Struc Segment
SS:BP ==> SMB_STR (after lclPROLOG)
On exit:
CF = 0 if successful
= 1 if not
|
lclPROLOG SMB_STR ; Address local vars
pusha ; Save all GP registers
; Display the leading text, unless asked not to
test LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
jnz short @F ; Jump if so
push ds ; Pass ptr to string
push [bp].SMBarg.argSMB_TEXT ; ...
call DispASCIIZ ; Display ASCIIZ string
@@:
mov di,[bp].SMBarg.argSMB_START ; Get struc start
mov bx,[bp].SMBarg.argSMB_OFFS ; ... offset
push fs:[bx+di].EDD.ELO ; Pass the ptr16
push fs:[bx+di].EDD.EHI ; ...
push ds ; ... ptr to format string
push offset ds:MSG_PTR16 ; ...
push lpOutput ; ... ptr to output routine
call RPRINTF16 ; Rprintf it, return with AX = # chars printed
add sp,4+4+4 ; Strip arguments from stack
clc ; Mark as successful
popa ; Restore
lclEPILOG SMB_STR ; Strip local vars and return
assume ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing
SMB_PTR16 endp ; End SMB_PTR16 procedure
NPPROC SMB_HEXRAW -- Display A Variable # Hex Bytes
assume ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|
Display a variable # (<= 16) Hex Bytes from FS.
On entry:
FS = Struc Segment
SS:BP ==> SMB_STR (after lclPROLOG)
On exit:
CF = 0 if successful
= 1 if not
|
lclPROLOG SMB_STR ; Address local vars
pusha ; Save all GP registers
; Display the leading text, unless asked not to
test LCL_FLAG,@LCL_XLEAD ; Skip displaying leading text?
jnz short @F ; Jump if so
push ds ; Pass ptr to string
push [bp].SMBarg.argSMB_TEXT ; ...
call DispASCIIZ ; Display ASCIIZ string
@@:
mov di,[bp].SMBarg.argSMB_START ; Get struc start
mov bx,[bp].SMBarg.argSMB_OFFS ; ... offset
push fs:[bx+di+12].EDD ; Pass the next dword
push fs:[bx+di+ 8].EDD ; ...
push fs:[bx+di+ 4].EDD ; ...
push fs:[bx+di+ 0].EDD ; ...
push HEXRAW_LEN ; Pass length (*FIXME*)
push ds ; ... ptr to format string
push offset ds:MSG_HEXRAW ; ...
push lpOutput ; ... ptr to output routine
call RPRINTF16 ; Rprintf it, return with AX = # chars printed
add sp,4+4+2+4*4 ; Strip arguments from stack
clc ; Mark as successful
popa ; Restore
lclEPILOG SMB_STR ; Strip local vars and return
assume ds:nothing,es:nothing,fs:nothing,gs:nothing,ss:nothing
SMB_HEXRAW endp ; End SMB_HEXRAW procedure
NPPROC SMB_PID -- Display A Processor ID
assume ds:DGROUP,es:nothing,fs:nothing,gs:nothing,ss:nothing
COMMENT|
Display a Processor ID from FS.
On entry:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -