From 251b270e4b0c9817ef029ca140ca4398bb45ccf4 Mon Sep 17 00:00:00 2001 From: Reto Buerki Date: Fri, 27 Feb 2015 10:26:40 +0100 Subject: [PATCH] hw_x86_64: Factor out _virt_mtc_addr to mtc_util.h header --- .../src/core/include/spec/x86_64/idt.h | 8 ------- .../src/core/include/spec/x86_64/mtc_util.h | 23 +++++++++++++++++++ repos/base-hw/src/core/spec/x86_64/idt.cc | 8 +------ 3 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 repos/base-hw/src/core/include/spec/x86_64/mtc_util.h diff --git a/repos/base-hw/src/core/include/spec/x86_64/idt.h b/repos/base-hw/src/core/include/spec/x86_64/idt.h index 004122f96..3980502fc 100644 --- a/repos/base-hw/src/core/include/spec/x86_64/idt.h +++ b/repos/base-hw/src/core/include/spec/x86_64/idt.h @@ -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. */ diff --git a/repos/base-hw/src/core/include/spec/x86_64/mtc_util.h b/repos/base-hw/src/core/include/spec/x86_64/mtc_util.h new file mode 100644 index 000000000..64a30d8d4 --- /dev/null +++ b/repos/base-hw/src/core/include/spec/x86_64/mtc_util.h @@ -0,0 +1,23 @@ +#ifndef _MTC_UTIL_H_ +#define _MTC_UTIL_H_ + +#include + +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_ */ diff --git a/repos/base-hw/src/core/spec/x86_64/idt.cc b/repos/base-hw/src/core/spec/x86_64/idt.cc index 10755c7da..30d666e17 100644 --- a/repos/base-hw/src/core/spec/x86_64/idt.cc +++ b/repos/base-hw/src/core/spec/x86_64/idt.cc @@ -1,19 +1,13 @@ #include +#include #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 */