summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndrew Boie <andrew.p.boie@intel.com>2016-09-22 15:59:36 -0700
committerAndrew Boie <andrew.p.boie@intel.com>2016-09-24 01:23:18 +0000
commit4dd1ca2c1a55e380cd0e04e6977e0755f3b53859 (patch)
treee01d3ee38e9faa0b0491f5ae0325c4e59a8ac9f9 /scripts
parentba5ddc189ebbbb24924d8c76ad442d430afb9ba0 (diff)
x86: add _init_irq_gate and use it in gen_idt
Change-Id: Id655e5c42ca82e48c5e6d80dcb1c7db8d207eb25 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gen_idt/gen_idt.c37
1 files changed, 3 insertions, 34 deletions
diff --git a/scripts/gen_idt/gen_idt.c b/scripts/gen_idt/gen_idt.c
index 9add545d4..4cf9b167e 100644
--- a/scripts/gen_idt/gen_idt.c
+++ b/scripts/gen_idt/gen_idt.c
@@ -77,8 +77,6 @@ static void generate_idt(void);
static void generate_interrupt_vector_bitmap(void);
static void clean_exit(int exit_code);
static void debug(const char *format, ...);
-static void idt_entry_create(uint64_t *pIdtEntry, uint32_t routine,
- unsigned int dpl);
struct genidt_header_s {
uint32_t spurious_addr;
@@ -128,35 +126,6 @@ static void debug(const char *format, ...)
va_end(vargs);
}
-static void idt_entry_create(uint64_t *pIdtEntry, uint32_t routine,
- unsigned int dpl)
-{
- uint32_t *pIdtEntry32 = (uint32_t *)pIdtEntry;
-
- pIdtEntry32[0] = (KERNEL_CODE_SEG_SELECTOR << 16) |
- ((uint16_t)routine);
-
- /*
- * The constant 0x8e00 results from the following:
- *
- * Segment Present = 1
- *
- * Descriptor Privilege Level (DPL) = 0 (dpl arg will be or'ed in)
- *
- * Interrupt Gate Indicator = 0xE
- * The _IntEnt() and _ExcEnt() stubs assume that an interrupt-gate
- * descriptor is used, and thus they do not issue a 'cli' instruction
- * given that the processor automatically clears the IF flag when
- * accessing the interrupt/exception handler via an interrupt-gate.
- *
- * Size of Gate (D) = 1
- *
- * Reserved = 0
- */
-
- pIdtEntry32[1] = (routine & 0xffff0000) | (0x8e00 | (dpl << 13));
-}
-
int main(int argc, char *argv[])
{
get_exec_name(argv[0]);
@@ -489,11 +458,11 @@ static void generate_idt(void)
*/
for (i = 0; i < num_vectors; i++) {
- uint64_t idt_entry;
+ struct segment_descriptor idt_entry;
ssize_t bytes_written;
- idt_entry_create(&idt_entry, generated_entry[i].isr,
- generated_entry[i].dpl);
+ _init_irq_gate(&idt_entry, KERNEL_CODE_SEG_SELECTOR,
+ generated_entry[i].isr, generated_entry[i].dpl);
bytes_written = write(fds[OFILE], &idt_entry, sizeof(idt_entry));
if (bytes_written != sizeof(idt_entry)) {