第一部分:
VOID
DoGlobalInitialization(
IN PBOOT_CONTEXT BootContextRecord
)
{
//
// Turn the cursor off
//
??? HW_CURSOR(0,127);
D:\srv03rtm\base\boot/inc/bldrx86.h:258:#define HW_CURSOR?????????? (*ExternalServicesTable->HardwareCursor)
第二部分:
一、中斷顯示服務—INT 10H
功能號:
00H —設置顯示器模式
01H —設置光標形狀
02H —設置光標位置
03H —讀取光標信息
04H —讀取光筆位置
05H —設置顯示頁
06H、07H —初始化或滾屏
08H —讀光標處的字符及其屬性
09H —在光標處按指定屬性顯示字符
0AH —在當前光標處顯示字符
0BH —設置調色板、背景色或邊框
0CH —寫圖形象素
0DH —讀圖形象素
0EH —在Teletype模式下顯示字符
0FH —讀取顯示器模式
10H —顏色
11H —字體
12H —顯示器的配置
13H —在終端模式下顯示字符串
1AH —讀取/設置顯示組合編碼
1BH —讀取功能/狀態信息
1CH —保存/恢復顯示器狀態
int 10h中斷例程的在光標位置顯示字符功能:
mov ah,9 ;在光標位置顯示字符
mov al,'a' ;字符
mov bl,7 ;顏色屬性
mov bh,0 ;第0頁
mov cx,3 ;字符重復個數
int 10h
(ah)=9表示調用的第10h號的中斷例程的9號子程序,功能為在光標位置顯示字符,可以提供要顯示的字符,顏色屬性,頁號字符重復個數作為參數
一般調用中斷例程的某號子程序,存儲在ah中
第三部分:
3、 功能02H
功能描述:用文本坐標下設置光標位置
入口參數:AH=02H
BH=顯示頁碼
DH=行(Y坐標)
DL= 列(X坐標)
出口參數:無
第四部分:
//
// Turn the cursor off
//
??? HW_CURSOR(0,127);
;++
;
; Name:
;
;?????? HardwareCursor
;
; Description:
;
;?????? Positions the hardware cursor and performs other display stuff.
;
; Arguments:
;
;???????????? ULONG Y coord (0 based)
;???????????? ULONG X coord (0 based)
;???? TOS ->? ULONG Flat return address (must be used with KeCodeSelector)
;
;?????? If X = 0x80000000, then Y contains values that get placed into
;?????????? ax (low word of Y) and bx (hi word of y).
;?????? Otherwise X,Y = coors for cursor
;
;
;--
EXPORT_ENTRY_MACRO??? HardwareCursor
;
; Move the arguments from the caller's 32bit stack to the SU module's
; 16bit stack.
;
??????? MAKE_STACK_FRAME_MACRO? <HardwareCursorFrame>, ebx
;
; Go into real mode. We still have the same stack and sp
; but we'll be executing in realmode.
;
??????? ENTER_REALMODE_MACRO
;
; Get the requested sectors. Arguments on realmode stack
; Make (bp) point to the bottom of the argument frame.
;
push???? bp
mov????? bp,sp
add????? bp,2
;
; Put the row (y coord) in dh and the column (x coord) in dl.
;
??????? mov????? eax,[bp].YCoord
mov????? edx,[bp].XCoord
cmp????? edx,80000000h
jne????? gotxy
??????? mov????? ebx,eax
shr????? ebx,16
jmp????? doint10
??? gotxy:
mov????? dh,al?? ??? ??? ??? ?DH=行(Y坐標)?? ??? ?
mov????? ah,2?? ??? ??? ??? ?02H —設置光標位置
mov????? bh,0
??? doint10:
int????? 10h
;
; Restore bp and remove stack-frame from stack
;
pop????? bp
??????? REMOVE_STACK_FRAME_MACRO <HardwareCursorFrame>
;
; Re-enable protect-mode and paging.
;
??????? RE_ENABLE_PAGING_MACRO
;
; Return to caller and the 32bit universe.
;
EXPORT_EXIT_MACRO
kd> p
osloader!DoGlobalInitialization+0x3b:
004012a8 6a7f??????????? push??? 7Fh
kd> p
osloader!DoGlobalInitialization+0x3d:
004012aa 6a00??????????? push??? 0
第五部分:
??? //
// Turn the cursor off
//
??? HW_CURSOR(0,127);
kd> dv
BootContextRecord = 0x00024538
kd> dx -r1 ((osloader!_BOOT_CONTEXT *)0x24538)
((osloader!_BOOT_CONTEXT *)0x24538)???????????????? : 0x24538 [Type: _BOOT_CONTEXT *]
[+0x000] FSContextPointer : 0x244e4 [Type: _FSCONTEXT_RECORD *]
[+0x004] ExternalServicesTable : 0x244ec [Type: _EXTERNAL_SERVICES_TABLE *]
[+0x008] MemoryDescriptorList : 0x70000 [Type: _SU_MEMORY_DESCRIPTOR *]
[+0x00c] MachineType????? : 0x0 [Type: unsigned long]
[+0x010] OsLoaderStart??? : 0x401000 [Type: unsigned long]
[+0x014] OsLoaderEnd????? : 0x4894a8 [Type: unsigned long]
[+0x018] ResourceDirectory : 0x487000 [Type: unsigned long]
[+0x01c] ResourceOffset?? : 0x87000 [Type: unsigned long]
[+0x020] OsLoaderBase???? : 0x400000 [Type: unsigned long]
[+0x024] OsLoaderExports? : 0x443b40 [Type: unsigned long]
[+0x028] BootFlags??????? : 0x0 [Type: unsigned long]
[+0x02c] NtDetectStart??? : 0x0 [Type: unsigned long]
[+0x030] NtDetectEnd????? : 0x0 [Type: unsigned long]
[+0x034] SdiAddress?????? : 0x0 [Type: unsigned long]
kd> dx -r1 ((osloader!_FSCONTEXT_RECORD *)0x244e4)
((osloader!_FSCONTEXT_RECORD *)0x244e4)???????????????? : 0x244e4 [Type: _FSCONTEXT_RECORD *]
[+0x000] BootDrive??????? : 0x80 [Type: unsigned char]
kd> dx -r1 ((osloader!_EXTERNAL_SERVICES_TABLE *)0x244ec)
((osloader!_EXTERNAL_SERVICES_TABLE *)0x244ec)???????????????? : 0x244ec [Type: _EXTERNAL_SERVICES_TABLE *]
[+0x000] RebootProcessor? : 0x22e60 [Type: void (__cdecl*)()]
[+0x004] DiskIOSystem???? : 0x22e6c [Type: long (__cdecl*)(unsigned char,unsigned char,unsigned short,unsigned short,unsigned char,unsigned char,unsigned char *)]
[+0x008] GetKey?????????? : 0x22e84 [Type: unsigned long (__cdecl*)()]
[+0x00c] GetCounter?????? : 0x22e90 [Type: unsigned long (__cdecl*)()]
[+0x010] Reboot?????????? : 0x22e9c [Type: void (__cdecl*)(unsigned long)]
[+0x014] DetectHardware?? : 0x22ec0 [Type: void (__cdecl*)(unsigned long,unsigned long,void *,unsigned long *,char *,unsigned long)]
[+0x018] HardwareCursor?? : 0x22ea8 [Type: void (__cdecl*)(unsigned long,unsigned long)]
[+0x01c] GetDateTime????? : 0x22eb4 [Type: void (__cdecl*)(unsigned long *,unsigned long *)]
[+0x020] ComPort????????? : 0x22ecc [Type: void (__cdecl*)(long,unsigned long,unsigned char)]
[+0x024] GetStallCount??? : 0x22ed8 [Type: unsigned long (__cdecl*)()]
[+0x028] InitializeDisplayForNt : 0x22ee4 [Type: void (__cdecl*)()]
[+0x02c] GetMemoryDescriptor : 0x22ef0 [Type: void (__cdecl*)()]
[+0x030] GetEddsSector??? : 0x22e78 [Type: long (__cdecl*)(unsigned char,unsigned long,unsigned long,unsigned short,unsigned char *,unsigned char)]
[+0x034] GetElToritoStatus : 0x22efc [Type: long (__cdecl*)(unsigned char *,unsigned char)]
[+0x038] GetExtendedInt13Params : 0x22f08 [Type: unsigned char (__cdecl*)(unsigned char *,unsigned char)]
[+0x03c] NetPcRomServices : 0x0 [Type: unsigned short (__cdecl*)(unsigned long,void *)]
[+0x040] ApmAttemptReconnect : 0x22f14 [Type: void (__cdecl*)()]
[+0x044] BiosRedirectService : 0x0 [Type: unsigned long (__cdecl*)(unsigned long)]
kd> p
kd> p
osloader!DoGlobalInitialization+0x45:
004012b2 ff5018????????? call??? dword ptr [eax+18h]?? ??? ?//[eax+18h]
kd> r
eax=000244ec ebx=004013a2 ecx=00000000 edx=00064544 esi=00024538 edi=0048164f
eip=004012b2 esp=00060ec4 ebp=00060ed0 iopl=0???????? nv up di pl zr na pe nc
cs=0008? ss=0010? ds=0010? es=0010? fs=0030? gs=0000???????????? efl=00000046
osloader!DoGlobalInitialization+0x45:
004012b2 ff5018????????? call??? dword ptr [eax+18h]? ds:0010:00024504=00022ea8
kd> dd 00060ec4
00060ec4? 00000000 0000007f 00024538 00061ff0
kd> ?7f
Evaluate expression: 127 = 0000007f
y=7f?? ?x=0