mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-29 07:19:45 +00:00
hw_x86_64: Factor out pseudo descriptor class to own header
This commit is contained in:
parent
d0f14cb941
commit
cfe89996e8
@ -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_ */
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <pseudo_descriptor.h>
|
||||||
|
|
||||||
#include "idt.h"
|
#include "idt.h"
|
||||||
|
|
||||||
extern int _mt_begin;
|
extern int _mt_begin;
|
||||||
@ -5,16 +7,6 @@ extern int _mt_idt;
|
|||||||
|
|
||||||
using namespace Genode;
|
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)
|
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)
|
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))));
|
_virt_mtc_addr(virt_base, (addr_t)&_mt_idt))));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user