idt probs

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
rockey

idt probs

Post by rockey »

how can i access lidt with the gcc inline assembler best
and can somebody give me a link to a site with a
good tutorial for the idtcreating with c...
thx for help
M. Schuetz

RE:idt probs

Post by M. Schuetz »

>On 2001-09-07 04:46:19, rockey wrote:
>how can i access lidt with the gcc inline assembler best
>and can somebody give me a link to a site with a
>good tutorial for the idtcreating with c...
>thx for help

First, you need to declare a local variable with the limit and offset
of the IDT:

struct
{
unsigned short Limit; /* 16 bit */
unsigned long * Offset; /* 32 bit */
} __attribute__((packed)) IDTR;

The ((packed)) attribute is important. If you don't use it, GCC will
insert 2 invisible bytes between Limit and Offset to align the Offset field
on a 32-bit boundary.

Now assign the fields:

extern unsigned long * IDT[];

IDTR.Limit = 2047; /* 256 entries */
IDTR.Offset = IDT;

Now you can load the IDT:

asm("lidt %0"
: /* no output */
: "m" (IDTR) /* memory operand */);

Hope this helps...

Marc Schuetz ([email protected])
Guest

RE:idt probs

Post by Guest »

it works
thx
Post Reply