mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 23:42:32 +00:00
hw_x86_64: Add Genode::Gdt class
The class provides the load() function which reloads the GDTR with the GDT address in the mtc region. This is needed to make the segments accessible to non-core threads. Make the _gdt_start label global to use it in the call to _virt_mtc_addr().
This commit is contained in:
parent
251b270e4b
commit
968ab15bbb
34
repos/base-hw/src/core/include/spec/x86_64/gdt.h
Normal file
34
repos/base-hw/src/core/include/spec/x86_64/gdt.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef _GDT_H_
|
||||
#define _GDT_H_
|
||||
|
||||
#include <pseudo_descriptor.h>
|
||||
#include <mtc_util.h>
|
||||
|
||||
extern int _gdt_start;
|
||||
|
||||
namespace Genode
|
||||
{
|
||||
/**
|
||||
* Global Descriptor Table (GDT)
|
||||
* See Intel SDM Vol. 3A, section 3.5.1
|
||||
*/
|
||||
class Gdt;
|
||||
}
|
||||
|
||||
class Genode::Gdt
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Load GDT from mtc region into GDTR.
|
||||
*
|
||||
* \param virt_base virtual base address of mode transition pages
|
||||
*/
|
||||
static void load(addr_t const virt_base)
|
||||
{
|
||||
asm volatile ("lgdt %0" : : "m" (Pseudo_descriptor (0x37,
|
||||
_virt_mtc_addr(virt_base, (addr_t)&_gdt_start))));
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _GDT_H_ */
|
@ -269,6 +269,7 @@
|
||||
.space 2
|
||||
|
||||
.global _gdt_ptr
|
||||
.global _gdt_start
|
||||
_gdt_ptr:
|
||||
.word _gdt_end - _gdt_start - 1 /* limit */
|
||||
.long _gdt_start /* base address */
|
||||
|
Loading…
Reference in New Issue
Block a user