If you set the DPL to 4, it will be 1
00, the 1 being thus considered as something else in the entry
I recommend using a structure with a variable for each bit
This is mine:
Code: Select all
typedef struct IDTEntry {
u16 loffset;
u16 segment;
int notsetA:1; // always set to 0
int trap:1; // if 0, there will be an automatic "cli" on interrupt
int setA:1; // always set to 1
int setB:1; // always set to 1
int bits32:1;
int notsetB:1; // always set to 0
int dpl:2;
int present:1;
u16 hoffset;
} __attribute__((packed)) IDTEntry;
Note that this is only for 32 bits
You can certainly improve this structure with like:
Code: Select all
struct {
...
#ifdef _64BITS_
u32 hhoffset;
#endif
}