x86: fix IDT entry definition
It was, in a nutshell, wrong. Fortunately, the incorrectly specified fields weren't being used by anything. Change-Id: I0fa63fa16a267502744a7a2c82865c7de8b5446e Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
869181a994
commit
313ed31253
3 changed files with 32 additions and 20 deletions
|
@ -96,8 +96,8 @@ uint8_t _stub_idx_from_vector(int vector)
|
|||
* the dynamic stubs
|
||||
*/
|
||||
idt_entry = (IDT_ENTRY *)(_idt_base_address + (vector << 3));
|
||||
stub_addr = (uint8_t *)((uint32_t)idt_entry->lowOffset +
|
||||
((uint32_t)idt_entry->hiOffset << 16));
|
||||
stub_addr = (uint8_t *)((uint32_t)idt_entry->offset_low +
|
||||
((uint32_t)idt_entry->offset_high << 16));
|
||||
|
||||
/*
|
||||
* Return the specific byte in the handler code which contains
|
||||
|
|
|
@ -46,22 +46,34 @@ extern "C" {
|
|||
#define _EXC_ERROR_CODE_FAULTS 0x27d00
|
||||
|
||||
|
||||
/*
|
||||
* Interrupt Descriptor Table (IDT) entry structure
|
||||
/**
|
||||
* @brief Interrupt Descriptor Table (IDT) entry structure
|
||||
*
|
||||
* (This is taken from Intel documentation, so don't try to interpret it
|
||||
* too deeply.)
|
||||
* See section 6.11 in x86 CPU manual vol. 3A
|
||||
*/
|
||||
|
||||
typedef struct idtEntry {
|
||||
unsigned short lowOffset;
|
||||
unsigned short segmentSelector;
|
||||
unsigned short reserved:5;
|
||||
unsigned short intGateIndicator:8;
|
||||
unsigned short descPrivLevel:2;
|
||||
unsigned short present:1;
|
||||
unsigned short hiOffset;
|
||||
} __packed IDT_ENTRY;
|
||||
typedef struct idt_entry {
|
||||
union {
|
||||
uint16_t offset_low;
|
||||
uint16_t reserved_task_gate_0;
|
||||
};
|
||||
uint16_t segment_selector;
|
||||
union {
|
||||
struct {
|
||||
uint8_t reserved:5;
|
||||
uint8_t always_0_0:3;
|
||||
};
|
||||
uint8_t reserved_task_gate_1;
|
||||
};
|
||||
uint8_t type:3; /* task:101, irq:110, trap:111 */
|
||||
uint8_t gate_size:1; /* size of gate, 1: 32-bit, 0:16-bit */
|
||||
uint8_t always_0_1:1;
|
||||
uint8_t dpl:2; /* Descriptor privilege level */
|
||||
uint8_t present:1; /* present yes/no */
|
||||
union {
|
||||
uint16_t offset_high;
|
||||
uint16_t reserved_task_gate_2;
|
||||
};
|
||||
} __packed IDT_ENTRY;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -116,14 +116,14 @@ int nanoIdtStubTest(void)
|
|||
pIdtEntry = (IDT_ENTRY *) (_idt_base_address + (TEST_SOFT_INT << 3));
|
||||
|
||||
offset = (uint16_t)((uint32_t)(&nanoIntStub) & 0xFFFF);
|
||||
if (pIdtEntry->lowOffset != offset) {
|
||||
if (pIdtEntry->offset_low != offset) {
|
||||
TC_ERROR("Failed to find low offset of nanoIntStub "
|
||||
"(0x%x) at vector %d\n", (uint32_t)offset, TEST_SOFT_INT);
|
||||
return TC_FAIL;
|
||||
}
|
||||
|
||||
offset = (uint16_t)((uint32_t)(&nanoIntStub) >> 16);
|
||||
if (pIdtEntry->hiOffset != offset) {
|
||||
if (pIdtEntry->offset_high != offset) {
|
||||
TC_ERROR("Failed to find high offset of nanoIntStub "
|
||||
"(0x%x) at vector %d\n", (uint32_t)offset, TEST_SOFT_INT);
|
||||
return TC_FAIL;
|
||||
|
@ -133,14 +133,14 @@ int nanoIdtStubTest(void)
|
|||
pIdtEntry = (IDT_ENTRY *) (_idt_base_address + (IV_DIVIDE_ERROR << 3));
|
||||
|
||||
offset = (uint16_t)((uint32_t)(&exc_divide_error_handlerStub) & 0xFFFF);
|
||||
if (pIdtEntry->lowOffset != offset) {
|
||||
if (pIdtEntry->offset_low != offset) {
|
||||
TC_ERROR("Failed to find low offset of exc stub "
|
||||
"(0x%x) at vector %d\n", (uint32_t)offset, IV_DIVIDE_ERROR);
|
||||
return TC_FAIL;
|
||||
}
|
||||
|
||||
offset = (uint16_t)((uint32_t)(&exc_divide_error_handlerStub) >> 16);
|
||||
if (pIdtEntry->hiOffset != offset) {
|
||||
if (pIdtEntry->offset_high != offset) {
|
||||
TC_ERROR("Failed to find high offset of exc stub "
|
||||
"(0x%x) at vector %d\n", (uint32_t)offset, IV_DIVIDE_ERROR);
|
||||
return TC_FAIL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue