atapi!IdeReadWrite函数分析中.txt
第一部分:
if (deviceExtension->DeviceFlags[Srb->TargetId] & DFLAGS_LBA) {
SelectIdeDevice(baseIoAddress1,
Srb->TargetId,
(IDE_LBA_MODE | ((startingSector & 0x0f000000) >> 24)));
IdePortOutPortByte (
baseIoAddress1->BlockNumber,
(UCHAR) ((startingSector & 0x000000ff) >> 0));
IdePortOutPortByte (
baseIoAddress1->CylinderLow,
(UCHAR) ((startingSector & 0x0000ff00) >> 8));
IdePortOutPortByte (
baseIoAddress1->CylinderHigh,
(UCHAR) ((startingSector & 0x00ff0000) >> 16));
第二部分:
//
// Device selection constants used for programming the device/head register.
//
#define IDE_LBA_MODE 0xE0
cPublicProc _WRITE_PORT_UCHAR ,2
cPublicFpo 2, 0
mov edx,[esp+4] ; (dx) = Port edx=000001f6
mov al,[esp+8] ; (al) = Value eax=800000e0
out dx,al
stdRET _WRITE_PORT_UCHAR
stdENDP _WRITE_PORT_UCHAR
0: kd> p
eax=800000e0 ebx=804f4d68 ecx=000000e0 edx=000001f6 esi=895e98a8 edi=89529734
eip=804f4d70 esp=f78d5eec ebp=f78d5f0c iopl=0 nv up ei ng nz na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000282
hal!WRITE_PORT_UCHAR+0x8:
804f4d70 ee out dx,al
第三部分:
IdePortOutPortByte (
baseIoAddress1->BlockNumber,
(UCHAR) ((startingSector & 0x000000ff) >> 0));
cPublicProc _WRITE_PORT_UCHAR ,2
cPublicFpo 2, 0
mov edx,[esp+4] ; (dx) = Port edx=000001f3
mov al,[esp+8] ; (al) = Value eax=8000003f
out dx,al
stdRET _WRITE_PORT_UCHAR
stdENDP _WRITE_PORT_UCHAR
0: kd> p
eax=8000003f ebx=804f4d68 ecx=000000e0 edx=000001f3 esi=895e98a8 edi=89529734
eip=804f4d70 esp=f78d5eec ebp=f78d5f0c iopl=0 nv up ei ng nz na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000282
hal!WRITE_PORT_UCHAR+0x8:
804f4d70 ee out dx,al
第四部分:
IdePortOutPortByte (
baseIoAddress1->CylinderLow,
(UCHAR) ((startingSector & 0x0000ff00) >> 8));
cPublicProc _WRITE_PORT_UCHAR ,2
cPublicFpo 2, 0
mov edx,[esp+4] ; (dx) = Port edx=000001f4
mov al,[esp+8] ; (al) = Value eax=00006000
out dx,al
stdRET _WRITE_PORT_UCHAR
stdENDP _WRITE_PORT_UCHAR
0: kd> p
eax=00006000 ebx=804f4d68 ecx=000000e0 edx=000001f4 esi=895e98a8 edi=89529734
eip=804f4d70 esp=f78d5eec ebp=f78d5f0c iopl=0 nv up ei pl nz na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000206
hal!WRITE_PORT_UCHAR+0x8:
804f4d70 ee out dx,al
第五部分:
IdePortOutPortByte (
baseIoAddress1->CylinderHigh,
(UCHAR) ((startingSector & 0x00ff0000) >> 16));
cPublicProc _WRITE_PORT_UCHAR ,2
cPublicFpo 2, 0
mov edx,[esp+4] ; (dx) = Port edx=000001f5
mov al,[esp+8] ; (al) = Value eax=00000060
out dx,al
stdRET _WRITE_PORT_UCHAR
0: kd> p
eax=00000060 ebx=804f4d68 ecx=000000e0 edx=000001f5 esi=895e98a8 edi=89529734
eip=804f4d70 esp=f78d5eec ebp=f78d5f0c iopl=0 nv up ei pl nz na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000206
hal!WRITE_PORT_UCHAR+0x8:
804f4d70 ee out dx,al