IDT and little-endian
Posted: Wed Jul 02, 2008 2:09 am
Hello,
I have problem with IDT. For example, y have structure:
struct IDT
{
unsigned short offset_0_15;
unsigned short selecteurSegment;
unsigned char zero;
unsigned char drapeau;
unsigned short offset_16_31;
};
If, for example, i use this values (it's only for example, it's not good values)
listeIDT.offset_0_15 = 0xAABB;
listeIDT.selecteurSegment = 0xCCDD;
listeIDT.zero = 0;
listeIDT.drapeau = 0x11;
listeIDT.offset_16_31 = 0xEEFF;
I have into memory:
Adress Value
0x40430C 0xBB
0x40430D 0xAA
0x40430E 0xDD
0x40430F 0xCC
0x404310 0x00
0x404311 0x11
0x404312 0xFF
0x404313 0xEE
But if my structure is:
struct IDT
{
unsigned short offset_0_15;
unsigned short selecteurSegment;
unsigned short zero_and_drapeau;
unsigned short offset_16_31;
};
and i use this values:
listeIDT.offset_0_15 = 0xAABB;
listeIDT.selecteurSegment = 0xCCDD;
listeIDT.drapeau_and_zero = 0x0011;
listeIDT.offset_16_31 = 0xEEFF;
i have into memory:
Adress Value
0x40430C 0xBB
0x40430D 0xAA
0x40430E 0xDD
0x40430F 0xCC
0x404310 0x11
0x404311 0x00
0x404312 0xFF
0x404313 0xEE
adress 0x404310 and 0x404311 are not in same order. Because little-endian.
How to order parameter of struct to have good order un memory ?
Best Regards.
I have problem with IDT. For example, y have structure:
struct IDT
{
unsigned short offset_0_15;
unsigned short selecteurSegment;
unsigned char zero;
unsigned char drapeau;
unsigned short offset_16_31;
};
If, for example, i use this values (it's only for example, it's not good values)
listeIDT.offset_0_15 = 0xAABB;
listeIDT.selecteurSegment = 0xCCDD;
listeIDT.zero = 0;
listeIDT.drapeau = 0x11;
listeIDT.offset_16_31 = 0xEEFF;
I have into memory:
Adress Value
0x40430C 0xBB
0x40430D 0xAA
0x40430E 0xDD
0x40430F 0xCC
0x404310 0x00
0x404311 0x11
0x404312 0xFF
0x404313 0xEE
But if my structure is:
struct IDT
{
unsigned short offset_0_15;
unsigned short selecteurSegment;
unsigned short zero_and_drapeau;
unsigned short offset_16_31;
};
and i use this values:
listeIDT.offset_0_15 = 0xAABB;
listeIDT.selecteurSegment = 0xCCDD;
listeIDT.drapeau_and_zero = 0x0011;
listeIDT.offset_16_31 = 0xEEFF;
i have into memory:
Adress Value
0x40430C 0xBB
0x40430D 0xAA
0x40430E 0xDD
0x40430F 0xCC
0x404310 0x11
0x404311 0x00
0x404312 0xFF
0x404313 0xEE
adress 0x404310 and 0x404311 are not in same order. Because little-endian.
How to order parameter of struct to have good order un memory ?
Best Regards.