hw_x86_64: Make _virt_idt_addr member more generic

Add label argument to function and rename it to _virt_mtc_addr. It can
be used to retrieve the virtual mtc address of any given label.
This commit is contained in:
Reto Buerki 2015-02-26 14:16:57 +01:00 committed by Christian Helmuth
parent b8e2249f51
commit bf5118fe54
2 changed files with 8 additions and 7 deletions

View File

@ -22,10 +22,12 @@ class Genode::Idt
};
/**
* Return virtual address of the IDT for given virtual mode transition
* base.
* Return virtual mtc address of the given label for the specified
* virtual mode transition base.
*
* \param virt_base virtual address of the mode transition pages
*/
static addr_t _virt_idt_addr(addr_t const virt_base);
static addr_t _virt_mtc_addr(addr_t const virt_base, addr_t const label);
/**
* 64-Bit Mode IDT gate, see Intel SDM Vol. 3A, section 6.14.1.

View File

@ -16,11 +16,10 @@ class Descriptor
} __attribute__((packed));
addr_t Idt::_virt_idt_addr(addr_t const virt_base)
addr_t Idt::_virt_mtc_addr(addr_t const virt_base, addr_t const label)
{
addr_t const phys = (addr_t)&_mt_idt;
addr_t const phys_base = (addr_t)&_mt_begin;
return virt_base + (phys - phys_base);
return virt_base + (label - phys_base);
}
void Idt::setup()
@ -47,5 +46,5 @@ void Idt::setup()
void Idt::load(addr_t const virt_base)
{
asm volatile ("lidt %0" : : "m" (Descriptor (sizeof(_table) - 1,
_virt_idt_addr(virt_base))));
_virt_mtc_addr(virt_base, (addr_t)&_mt_idt))));
}