Page 1 of 1

LIDT and LGDT

Posted: Wed Jul 05, 2006 2:21 am
by Tolga
Hi. I don't know AT&T assembly. So, i will ask 2 question:

1. I have GDTR Structure;
struct tgdtr
{
unsigned short limit;
unsigned long base;
};

How can load this GDTR structure to GDTR with inline assembly?

2. I have IDTR Structure
struct tidtr
{
unsigned short limit;
unsigned long base;
};

How can load this IDTR structure to IDTR with inline assembly?

Thanks. ;)

Re:LIDT and LGDT

Posted: Wed Jul 05, 2006 2:56 am
by viral
Hello..
How can load this GDTR structure to GDTR with inline assembly?
Let GdtDesc is object of your "struct tgdtr"

Code: Select all

asm volatile ("lgdt %0" : "=m" (GdtDesc));
How can load this IDTR structure to IDTR with inline assembly?
Let IdtDesc is object of your "struct tidtr"

Code: Select all

asm volatile ("lidt (%%eax)" : : "a"(&IdtDesc));

Re:LIDT and LGDT

Posted: Wed Jul 05, 2006 3:56 am
by Tolga
Thanks and where can i learn AT&T assembly for GCC? I want to learn it for only Kernel development in GCC.

Re:LIDT and LGDT

Posted: Wed Jul 05, 2006 10:49 am
by viral
Hi...
You can find the tutorial about inline assembly in GCC at "tutorial" section of www.osdever.net..

All the best.....