LIDT and LGDT

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Tolga

LIDT and LGDT

Post 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. ;)
viral

Re:LIDT and LGDT

Post 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));
Tolga

Re:LIDT and LGDT

Post by Tolga »

Thanks and where can i learn AT&T assembly for GCC? I want to learn it for only Kernel development in GCC.
viral

Re:LIDT and LGDT

Post by viral »

Hi...
You can find the tutorial about inline assembly in GCC at "tutorial" section of www.osdever.net..

All the best.....
Post Reply