hw_x86_64: Factor out _virt_mtc_addr to mtc_util.h header

This commit is contained in:
Reto Buerki 2015-02-27 10:26:40 +01:00 committed by Christian Helmuth
parent cfe89996e8
commit 251b270e4b
3 changed files with 24 additions and 15 deletions

View File

@ -21,14 +21,6 @@ class Genode::Idt
SYSCALL_VEC = 0x80,
};
/**
* 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_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

@ -0,0 +1,23 @@
#ifndef _MTC_UTIL_H_
#define _MTC_UTIL_H_
#include <base/stdint.h>
extern int _mt_begin;
namespace Genode
{
/**
* Return virtual mtc address of the given label for the specified
* virtual mode transition base.
*
* \param virt_base virtual base of the mode transition pages
*/
static addr_t _virt_mtc_addr(addr_t const virt_base, addr_t const label)
{
addr_t const phys_base = (addr_t)&_mt_begin;
return virt_base + (label - phys_base);
}
}
#endif /* _MTC_UTIL_H_ */

View File

@ -1,19 +1,13 @@
#include <pseudo_descriptor.h>
#include <mtc_util.h>
#include "idt.h"
extern int _mt_begin;
extern int _mt_idt;
using namespace Genode;
addr_t Idt::_virt_mtc_addr(addr_t const virt_base, addr_t const label)
{
addr_t const phys_base = (addr_t)&_mt_begin;
return virt_base + (label - phys_base);
}
void Idt::setup()
{
/* TODO: Calculate from _mt_isrs label */