hw_x86_64: Factor out pseudo descriptor class to own header

This commit is contained in:
Reto Buerki 2015-02-27 10:09:28 +01:00 committed by Christian Helmuth
parent d0f14cb941
commit cfe89996e8
2 changed files with 29 additions and 11 deletions

View File

@ -0,0 +1,26 @@
#ifndef _PSEUDO_DESCRIPTOR_H_
#define _PSEUDO_DESCRIPTOR_H_
#include <base/stdint.h>
namespace Genode
{
/**
* Pseudo Descriptor
*
* See Intel SDM Vol. 3A, section 3.5.1
*/
class Pseudo_descriptor;
}
class Genode::Pseudo_descriptor
{
private:
uint16_t _limit;
uint64_t _base;
public:
Pseudo_descriptor(uint16_t l, uint64_t b) : _limit(l), _base (b) { };
} __attribute__((packed));
#endif /* _PSEUDO_DESCRIPTOR_H_ */

View File

@ -1,3 +1,5 @@
#include <pseudo_descriptor.h>
#include "idt.h"
extern int _mt_begin;
@ -5,16 +7,6 @@ extern int _mt_idt;
using namespace Genode;
class Descriptor
{
private:
uint16_t _limit;
uint64_t _base;
public:
Descriptor(uint16_t l, uint64_t b) : _limit(l), _base (b) {};
} __attribute__((packed));
addr_t Idt::_virt_mtc_addr(addr_t const virt_base, addr_t const label)
{
@ -45,6 +37,6 @@ void Idt::setup()
void Idt::load(addr_t const virt_base)
{
asm volatile ("lidt %0" : : "m" (Descriptor (sizeof(_table) - 1,
asm volatile ("lidt %0" : : "m" (Pseudo_descriptor (sizeof(_table) - 1,
_virt_mtc_addr(virt_base, (addr_t)&_mt_idt))));
}