IDT descriptor
IDT descriptor
in a descriptor there are two offsets....how do i use bitshifts to form 2 offsets from one?
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:IDT descriptor
the two OFFSETS you indicate are the high 16 bits and the low 16 bits of the base adress of the handler pointed to by the descriptor.
say you want to save an adress a into such a descriptor,
you 'll have to do the following:
typedef int (* handler_t)(int);
handler_t b=hwint01;
you pass b to a function tha builds the descriptor:
unsigned long adress;
unsigned short low_base;
unsigned short high_base;
adress=(unsigned long)b;
low_base=adress&0x0000ffff; //only the low 16 bits!
high_base=adress>>16; //only the high 16 bits! - right shift
hope this helps
stay safe
say you want to save an adress a into such a descriptor,
you 'll have to do the following:
typedef int (* handler_t)(int);
handler_t b=hwint01;
you pass b to a function tha builds the descriptor:
unsigned long adress;
unsigned short low_base;
unsigned short high_base;
adress=(unsigned long)b;
low_base=adress&0x0000ffff; //only the low 16 bits!
high_base=adress>>16; //only the high 16 bits! - right shift
hope this helps
stay safe
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:IDT descriptor
The name of the function stands for the functions adress, gosh. So, you pass the function name to an other function via function-pointer or via &-operator.
It is like a label in nasm or any other assembler.
to extract the adress you can do either
unsigned long adress = (unsigned long)&your_function
or
(void *t)(int)=your_function; //to build a pointer to the function.
unsigned long adress =(unsigned long)t;
Still un-clear?
If someone finds mistakes pls tell & correct.
It is like a label in nasm or any other assembler.
to extract the adress you can do either
unsigned long adress = (unsigned long)&your_function
or
(void *t)(int)=your_function; //to build a pointer to the function.
unsigned long adress =(unsigned long)t;
Still un-clear?
If someone finds mistakes pls tell & correct.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image