Back to Website

windows中中断向量设置问题?

Moderators: Lone_Rifle, unlinux

windows中中断向量设置问题?

Postby fengshuiyue » Tue Jun 22, 2010 2:37 pm

刚开始看windows内核情景分析,对中断向量表的处理只一块很迷惑.
文中这样描述:

I have just started to look at and analyse the Windows kernel, and am very confused with how interrupts are treated. As follows:

windows中中断向量的设置为:
in windows, the interrupt vector is set to:
_kildt
idt _kiTrap0 ,INT_32_DPL0
idt _kitTap1,INT_32_DPL0
............

idt _kitTap0,INT_32_DPL0可展开为 (can be expanded to)
_kitTap0 ,INT_32_DPL0,KGDT_R0_CODE

typedef struct _KIDTENTRY
{
USHORT Offset,
USHORT Selector,
USHORT Access,
USHORT ExtendOffset,
}KIDTENTRY,*KIDTENTRY;

extern KIDTENTRY kildt[];//与上面的_kildt对应 (corresponds to _kildt found above)

VOID INT _FUNCTION NTAPI
KeInitException(VOID)
{
............
for(int i=0;i<MAXIMUM_IDTVECTOR;i++)
{
FilppedSelector=kildt;
kildt[i].Selector=kildt[i].ExtendedOffset;//我在这儿很迷惑,ExtendedOffset没赋值如何使用,还有为何要将这儿两个交换?I'm curious by this. ExtendedOffset is not initialized here, so why do we swap values?
kildt[i].ExtendOffset=FilppedSelector;
}

[i]Edited by LoneRifle for translation.
fengshuiyue
 
Posts: 2
Joined: Tue Jun 22, 2010 2:20 pm

Re: windows中中断向量设置问题?

Postby fengshuiyue » Wed Jun 30, 2010 5:24 am

我是这样理解的:
因为:
.macro idt Handler bit
.long \Handler ;32bit
.short \bit ;16bit
.short KGDT_R0_CODE ;16bit
.endm
从宏定义中可以看出_kitTap0占32bit,与下面的数据结构应是这样对应:
typedef struct _KIDTENTRY
{
USHORT Offset, →→→→ ↘
USHORT Selector, ↘
→_kitTap0的地址
USHORT Access, ↗
USHORT ExtendOffset →→→ ↗
}KIDTENTRY,*KIDTENTRY;
所以要交换。
fengshuiyue
 
Posts: 2
Joined: Tue Jun 22, 2010 2:20 pm


Return to Chinese

Who is online

Users browsing this forum: No registered users and 2 guests

cron