📄 mp.inc
字号:
GetMPInfo:
pushad
push es
call ClearScreen
call CheckMPtablePresent
jc MPabsent
call DisplayMPSInformation
jc MPabsent
mov al,0ffh
jmp short ExitMPView
MPabsent:
call DisplayMPNoSupport
stc
ExitMPView:
lea di,SubFuncSelect
mov al,0f3h
mov ds:[di],al
pop es
popad
ret
;----------------------------------
CheckMPtablePresent:
push es
push cx
mov ax,0f000h
mov es,ax
mov cx,0fff0h
xor di,di
LoopCheckMP:
mov ah,es:[di]
cmp ah,'_'
jnz LoopCheckMPLabel
mov ah,es:[di+1]
cmp ah,'M'
jnz LoopCheckMPLabel
mov ah,es:[di+2]
cmp ah,'P'
jnz LoopCheckMPLabel
mov ah,es:[di+3]
cmp ah,'_'
jz MPBIOSSupport
LoopCheckMPLabel:
inc di
loop LoopCheckMP
jmp NoMPTableFound
MPBIOSSupport:
lea si,MPStartAddress
mov ds:[si],di
clc
jmp short CheckMPBiosPresentExit
NoMPTableFound:
stc
CheckMPBiosPresentExit:
pop cx
pop es
ret
;----------------------------------------------------
DisplayMPSInformation:
;Hide Cursor
mov cx,200eh
call SetCursorType
;;Clear Typex count
lea si,Type0EntryCount
mov ax,0
mov ds:[si],ax
mov ds:[si+4],ax
mov ds:[si+8],ax
mov ds:[si+12],ax
mov ds:[si+16],ax
;;
mov dx,HeaderPosition-0102h
call SetCursor
lea si,MPTableString
call DisplayString
lea si,MPStartFSeg
call DisplayString
lea si,MPStartAddress
mov ax,ds:[si]
ror ax,8
call DisplayHex
ror ax,8
call DisplayHex
lea si,crlf
call DisplayString
;;Display MPS version
push es
mov ax,0f000h
mov es,ax
lea si,MPTableVersion
call DisplayString
lea si,MPStartAddress
mov di,ds:[si]
mov al,es:[di+9]
shl al,4
call DisplayHex
lea si,crlf
call DisplayString
;;Display physical address
lea si,MPPhysicalAddress
call DisplayString
mov ax,es:[di+6]
lea si,PCMPSegment
mov ds:[si],ax
ror ax,8
call DisplayHex
ror ax,8
call DisplayHex
mov ax,es:[di+4]
lea si,PCMPAddress
mov ds:[si],ax
ror ax,8
call DisplayHex
ror ax,8
call DisplayHex
;;
lea si,crlf
call DisplayString
call GetPCMPAddress
;;Record Enter Count
lea si,EntryCount
mov ax,es:[di+34]
mov ds:[si],ax
;;DisplayPCMP header
lea si,PCMPHeader
mov bl,(Blue shl 4)+Yellow
call DisplayStringAttrib
lea si,crlf
call DisplayString
;;Set PCMP window color
call GetCursor
mov cx,dx
mov bh,Cyan
add dx,054fh
call SetWindowsAttribute
;;Display PCMP signature
lea si,PCMPString
call DisplayString
mov al,es:[di]
cmp al,'P'
jnz MP_table_absent
call DisplayChar
mov al,es:[di+1]
cmp al,'C'
jnz MP_table_absent
call DisplayChar
mov al,es:[di+2]
cmp al,'M'
jnz MP_table_absent
call DisplayChar
mov al,es:[di+3]
cmp al,'P'
jnz MP_table_absent
call DisplayChar
;;Dispaly MP version
lea si,crlf
call DisplayString
lea si,PCMPTableVersion
call DisplayString
mov al,es:[di+6]
shl al,4
call DisplayHex
;;Display MP OEM ID
lea si,crlf
call DisplayString
lea si,PCMPTableOEMID
call DisplayString
mov cx,08
mov bx,08
DisplayMPOEMID:
mov al,es:[di+bx]
call DisplayChar
inc bx
loop DisplayMPOEMID
;;Display MP Product ID
lea si,crlf
call DisplayString
lea si,PCMPTablePDID
call DisplayString
mov cx,12
mov bx,16
DisplayMPPDID:
mov al,es:[di+bx]
call DisplayChar
inc bx
loop DisplayMPPDID
;;MP Local APIC address
lea si,crlf
call DisplayString
lea si,PCMPLocalAPIC
call DisplayString
mov al,es:[di+39]
call DisplayHex
mov al,es:[di+38]
call DisplayHex
mov al,es:[di+37]
call DisplayHex
mov al,es:[di+36]
call DisplayHex
;;Display Entries count
lea si,MPEntryCount
call DisplayString
lea si,EntryCount
mov ax,ds:[si]
ror ax,8
call DisplayHex
ror ax,8
call DisplayHex
;;Calc Types entries
call CalcTypeEntries
;;Option for type entry
call SelectEntryType
pop es
clc
ret
MP_table_absent:
pop es
stc
ret
;-----------------------------------
DisplayMPNoSupport:
mov dx,0618h
call SetCursor
lea si,MPTableNotFound
mov bl,(White shl 4)+Red
call DisplayStringAttrib
call WaitOneKey
ret
;-----------------------------------
CalcTypeEntries:
push bx
lea si,EntryCount
mov cx,ds:[si]
mov bx,44
LoopReadTypeEntry:
push cx
mov al,es:[di+bx]
cmp al,0
jz MPType0Found
cmp al,1
jz MPType1Found
cmp al,2
jz MPType2Found
cmp al,3
jz MPType3Found
cmp al,4
jz MPType4Found
pop cx
jmp ExitCountEntry
MPType1Found:
lea si,Type1EntryAddress
mov dx,si
lea si,Type1EntryCount
call RecordEntries
jmp short ContinueCountEntry
MPType2Found:
lea si,Type2EntryAddress
mov dx,si
lea si,Type2EntryCount
call RecordEntries
jmp short ContinueCountEntry
MPType3Found:
lea si,Type3EntryAddress
mov dx,si
lea si,Type3EntryCount
call RecordEntries
jmp short ContinueCountEntry
MPType4Found:
lea si,Type4EntryAddress
mov dx,si
lea si,Type4EntryCount
call RecordEntries
jmp short ContinueCountEntry
MPType0Found:
lea si,Type0EntryCount
mov ax,ds:[si]
inc ax
mov ds:[si],ax
cmp ax,1
jnz ContinueCountEntry
lea si,Type0EntryAddress
mov ax,di
add ax,bx
mov ds:[si],ax
add bx,20
ContinueCountEntry:
pop cx
Loop LoopReadTypeEntry
ExitCountEntry:
pop bx
ret
;-----------------------------------
RecordEntries:
mov ax,ds:[si]
inc ax
mov ds:[si],ax
cmp ax,1
jnz TypexSkipAddress
mov si,dx
mov ax,di
add ax,bx
mov ds:[si],ax
TypexSkipAddress:
add bx,8
ret
;-----------------------------------
GetPCMPAddress:
lea si,PCMPSegment
mov ax,ds:[si]
shl ax,12
mov es,ax
lea si,PCMPAddress
mov ax,ds:[si]
mov di,ax
ret
;-----------------------------------
SelectEntryType:
lea si,crlf
call DisplayString
call GetCursor
lea si,TypeEntryPosn
mov ds:[si],dx
mov cx,dx
mov bh,(Blue shl 4)+Cyan
add dx,0423h
call SetWindowsAttribute
push di
mov cx,5
mov di, offset cs:MPSEntryString
DisplayTypeEntry:
mov si,cs:[di]
call DisplayString
lea si,crlf
call DisplayString
inc di
inc di
loop DisplayTypeEntry
pop di
call SelectBar
ret
;----------------------------------------------
SelectBar:
lea si,TypeEntryPosn
mov dx,ds:[si]
push dx
call SetCursor
lea si,CPUEntry
mov bl,Red+LightColor+(Blue shl 4)
call DisplayStringAttrib
pop dx
call SetCursor
MPTypeCheckKey:
call WaitOneKey
cmp ah,KeyPgup
jz MPTypeSelectExit
cmp ah,KeyPgDn
jz MPTypeSelectExit
cmp al,KeyEsc
jz MPTypeSelectExit
cmp ah,KeyF10
jz MPTypeSelectExit
cmp al,KeyEnter
jz MPTypeSelect
cmp ah,KeyUp
jz MPTypeKeyUp
cmp ah,KeyDown
jz MPTypeKeyDown
jmp MPTypeCheckKey
MPTypeKeyDown:
call GetCursor
inc dh
lea si,TypeEntryPosn
mov ax,ds:[si]
add ah,04h
cmp ah,dh
jae MPTypeOKBar
mov dx,ds:[si]
jmp short MPTypeOKBar
MPTypeKeyUp:
call GetCursor
dec dh
lea si,TypeEntryPosn
mov ax,ds:[si]
cmp ah,dh
jbe MPTypeOKBar
mov dx,ds:[si]
add dh,04h
; jmp short MPTypeOKBar
MPTypeOKBar:
call SetCursor
lea si,TypeEntryPosn
call ChangeCursorAttribute
jmp MPTypeCheckKey
MPTypeSelect:
call StoreScreenB
call GetCursor
push dx
lea si,TypeEntryPosn
mov ax,ds:[si]
sub dh,ah
movzx bx,dh
shl bx,1
lea si,ViewTypeEntries
mov dx,0100h
call SetCursor
call word ptr cs:[si+bx]
MPViewExtByte:
MPViewTypeBIOSChar:
call WaitOneKey
call RestoreScreenB
pop dx
call SetCursor
jmp MPTypeCheckKey
MPTypeSelectExit:
lea si,SearchFlag
mov ds:[si],ah
ret
;----------------------------------------
MPType0Viewer:
mov bh,(Blue shl 4)+White+LightColor
mov cx,0328h
mov dx,0d41h
call SetWindowsAttribute
mov dx,032dh
call SetCursor
lea si,MPCPUEntry
mov bl,Yellow+(Blue shl 4)
call DisplayStringAttrib
mov dx,0428h
call SetCursor
lea si,EntryType
call DisplayString
mov al,0
call DisplayHex
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -