Reverted the removal of configure_idt_entry()

Commit 227cc19890
"add alpha version of x64 support"
removed configure_idt_entry(), but this is used within the
lguest branch.
This commit is contained in:
Jacek Galowicz 2012-06-13 09:57:01 +02:00
parent 49eb099b80
commit ecb3fb5af2
2 changed files with 25 additions and 13 deletions

View file

@ -119,6 +119,16 @@ void idt_install(void);
void idt_set_gate(unsigned char num, size_t base, unsigned short sel,
unsigned char flags);
/** @brief Configures and returns a IDT entry with chosen attributes
*
* Just feed this function with base, selector and the flags
* you have seen in idt.h
*
* @return a preconfigured idt descriptor
*/
void configure_idt_entry(idt_entry_t *dest_entry, size_t base,
unsigned short sel, unsigned char flags);
#ifdef __cplusplus
}
#endif

View file

@ -46,6 +46,20 @@ static idt_entry_t idt[256] = {[0 ... 255] = {0, 0, 0, 0, 0}};
#endif
static idt_ptr_t idtp;
void configure_idt_entry(idt_entry_t *dest_entry, size_t base,
unsigned short sel, unsigned char flags)
{
/* The interrupt routine's base address */
dest_entry->base_lo = (base & 0xFFFF);
dest_entry->base_hi = (base >> 16) & 0xFFFF;
/* The segment or 'selector' that this IDT entry will use
* is set here, along with any access flags */
dest_entry->sel = sel;
dest_entry->always0 = 0;
dest_entry->flags = flags;
}
/*
* Use this function to set an entry in the IDT. Alot simpler
* than twiddling with the GDT ;)
@ -53,19 +67,7 @@ static idt_ptr_t idtp;
void idt_set_gate(unsigned char num, size_t base, unsigned short sel,
unsigned char flags)
{
/* The interrupt routine's base address */
idt[num].base_lo = (base & 0xFFFF);
idt[num].base_hi = (base >> 16) & 0xFFFF;
#ifdef CONFIG_X86_64
idt[num].base_hi64 = (base >> 32) & 0xFFFFFFFF;
idt[num].reserved = 0x0;
#endif
/* The segment or 'selector' that this IDT entry will use
* is set here, along with any access flags */
idt[num].sel = sel;
idt[num].always0 = 0x0;
idt[num].flags = flags;
configure_idt_entry(&idt[num], base, sel, flags);
}
extern void isrsyscall(void);