How to display gdtr/idtr

Hi, All:
I use the following code to display gdtr/idtr.
typedef struct _X86_DR
{
USHORT Limit;
LONG Base;
}X86_DR,*PX86_DR;

X86_DR mem_gdtr;
X86_DR mem_idtr;
_asm
{
sgdt mem_gdtr;
sidt mem_idtr;
}

KdPrint((“gdtr.Limit=%x,gdtr.Base=%x, idtr.Limit=%x,idtr.Base=%x\n”,
mem_gdtr.Limit,
mem_gdtr.Base,
mem_idtr.Limit,
mem_idtr.Base
));

the output in Windbg is “gdtr.Limit=3ff,gdtr.Base=f3fc8003, idtr.Limit=7ff,idtr.Base=f3fc8003”.

if I use “r gdtr” and “r idtr” , the output is

kd> r idtr
idtr=80036400
kd> r gdtr
gdtr=80036000

What is wrong with my code?
Thanks a lot!

Try this,

typedef struct _X86_DR
{
USHORT Limit;
ULONG Base;
}X86_DR,*PX86_DR;

Kind Regards,
Cathal

On 11/29/06, xxxxx@gmail.com wrote:
>
> Hi, All:
> I use the following code to display gdtr/idtr.
> typedef struct _X86_DR
> {
> USHORT Limit;
> LONG Base;
> }X86_DR,*PX86_DR;
>
> X86_DR mem_gdtr;
> X86_DR mem_idtr;
> _asm
> {
> sgdt mem_gdtr;
> sidt mem_idtr;
> }
>
> KdPrint(("gdtr.Limit=%x,gdtr.Base=%x, idtr.Limit=%x,idtr.Base=%x\n
> ",
> mem_gdtr.Limit,
> mem_gdtr.Base,
> mem_idtr.Limit,
> mem_idtr.Base
> ));
>
> the output in Windbg is “gdtr.Limit=3ff,gdtr.Base=f3fc8003,
> idtr.Limit=7ff,idtr.Base=f3fc8003”.
>
> if I use “r gdtr” and “r idtr” , the output is
>
> kd> r idtr
> idtr=80036400
> kd> r gdtr
> gdtr=80036000
>
> What is wrong with my code?
> Thanks a lot!
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

#pragma pack (1) your X86_DR structure :slight_smile:

Christiaan

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Wednesday, November 29, 2006 10:02 AM
Subject: [ntdev] How to display gdtr/idtr

> Hi, All:
> I use the following code to display gdtr/idtr.
> typedef struct _X86_DR
> {
> USHORT Limit;
> LONG Base;
> }X86_DR,*PX86_DR;
>
> X86_DR mem_gdtr;
> X86_DR mem_idtr;
> _asm
> {
> sgdt mem_gdtr;
> sidt mem_idtr;
> }
>
> KdPrint((“gdtr.Limit=%x,gdtr.Base=%x, idtr.Limit=%x,idtr.Base=%x\n”,
> mem_gdtr.Limit,
> mem_gdtr.Base,
> mem_idtr.Limit,
> mem_idtr.Base
> ));
>
> the output in Windbg is “gdtr.Limit=3ff,gdtr.Base=f3fc8003, idtr.Limit=7ff,idtr.Base=f3fc8003”.
>
> if I use “r gdtr” and “r idtr” , the output is
>
> kd> r idtr
> idtr=80036400
> kd> r gdtr
> gdtr=80036000
>
> What is wrong with my code?
> Thanks a lot!
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Oh! yes.
Thank you, Christiaan Ghijselinck!