|
@@ -116,9 +116,15 @@ struct [[gnu::packed]] IDTEntry
|
|
u16 offset_1; // offset bits 0..15
|
|
u16 offset_1; // offset bits 0..15
|
|
u16 selector; // a code segment selector in GDT or LDT
|
|
u16 selector; // a code segment selector in GDT or LDT
|
|
|
|
|
|
- u8 zero; // unused, set to 0 (maybe used on amd64)
|
|
|
|
|
|
+#if ARCH(I386)
|
|
|
|
+ u8 zero; // unused, set to 0
|
|
|
|
+#else
|
|
|
|
+ struct {
|
|
|
|
+ u8 interrupt_stack_table : 3;
|
|
|
|
+ u8 zero : 5; // unused, set to 0
|
|
|
|
+ };
|
|
|
|
+#endif
|
|
struct {
|
|
struct {
|
|
- // FIXME: Is the order correct?
|
|
|
|
u8 gate_type : 4;
|
|
u8 gate_type : 4;
|
|
u8 storage_segment : 1;
|
|
u8 storage_segment : 1;
|
|
u8 descriptor_privilege_level : 2;
|
|
u8 descriptor_privilege_level : 2;
|
|
@@ -126,7 +132,6 @@ struct [[gnu::packed]] IDTEntry
|
|
} type_attr; // type and attributes
|
|
} type_attr; // type and attributes
|
|
u16 offset_2; // offset bits 16..31
|
|
u16 offset_2; // offset bits 16..31
|
|
#if !ARCH(I386)
|
|
#if !ARCH(I386)
|
|
-// we may need to switch those around?
|
|
|
|
u32 offset_3;
|
|
u32 offset_3;
|
|
u32 zeros;
|
|
u32 zeros;
|
|
#endif
|
|
#endif
|
|
@@ -135,6 +140,9 @@ struct [[gnu::packed]] IDTEntry
|
|
IDTEntry(FlatPtr callback, u16 selector_, IDTEntryType type, u8 storage_segment, u8 privilege_level)
|
|
IDTEntry(FlatPtr callback, u16 selector_, IDTEntryType type, u8 storage_segment, u8 privilege_level)
|
|
: offset_1 { (u16)((FlatPtr)callback & 0xFFFF) }
|
|
: offset_1 { (u16)((FlatPtr)callback & 0xFFFF) }
|
|
, selector { selector_ }
|
|
, selector { selector_ }
|
|
|
|
+#if !ARCH(I386)
|
|
|
|
+ , interrupt_stack_table { 0 }
|
|
|
|
+#endif
|
|
, zero { 0 }
|
|
, zero { 0 }
|
|
, type_attr {
|
|
, type_attr {
|
|
.gate_type = (u8)type,
|
|
.gate_type = (u8)type,
|
|
@@ -150,7 +158,7 @@ struct [[gnu::packed]] IDTEntry
|
|
{
|
|
{
|
|
}
|
|
}
|
|
|
|
|
|
- u32 off()
|
|
|
|
|
|
+ FlatPtr off()
|
|
{
|
|
{
|
|
#if ARCH(I386)
|
|
#if ARCH(I386)
|
|
return (u32)offset_2 << 16 & (u32)offset_1;
|
|
return (u32)offset_2 << 16 & (u32)offset_1;
|
|
@@ -165,4 +173,6 @@ struct [[gnu::packed]] IDTEntry
|
|
};
|
|
};
|
|
// clang-format on
|
|
// clang-format on
|
|
|
|
|
|
|
|
+static_assert(sizeof(IDTEntry) == 2 * sizeof(void*));
|
|
|
|
+
|
|
}
|
|
}
|