mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 10:01:57 +00:00
hw_x86_64: use 'muen' SPEC to implement aspect
This commit is contained in:
parent
750c4ad81d
commit
9f1beaa036
10
repos/base-hw/lib/mk/core-muen.mk
Normal file
10
repos/base-hw/lib/mk/core-muen.mk
Normal file
@ -0,0 +1,10 @@
|
||||
#
|
||||
# \brief Build config for parts of core that depend on Muen status
|
||||
# \author Stefan Kalkowski
|
||||
# \date 2015-06-02
|
||||
#
|
||||
|
||||
REQUIRES = x86_64
|
||||
|
||||
# add library dependencies
|
||||
LIBS += core-muen_off
|
8
repos/base-hw/lib/mk/muen/core-muen.mk
Normal file
8
repos/base-hw/lib/mk/muen/core-muen.mk
Normal file
@ -0,0 +1,8 @@
|
||||
#
|
||||
# \brief Build config for parts of core that depend on Muen status
|
||||
# \author Stefan Kalkowski
|
||||
# \date 2015-06-02
|
||||
#
|
||||
|
||||
# add library dependencies
|
||||
LIBS += core-muen_on
|
@ -10,8 +10,6 @@ INC_DIR += $(REP_DIR)/src/core/include/spec/x86
|
||||
|
||||
# add C++ sources
|
||||
SRC_CC += spec/x86/platform_support.cc
|
||||
SRC_CC += spec/x86/kernel/thread.cc
|
||||
SRC_CC += spec/x86/kernel/cpu.cc
|
||||
SRC_CC += spec/x86/kernel/pd.cc
|
||||
SRC_CC += spec/x86/cpu.cc
|
||||
SRC_CC += spec/x86/bios_data_area.cc
|
||||
|
17
repos/base-hw/lib/mk/x86_64/core-muen_off.mk
Normal file
17
repos/base-hw/lib/mk/x86_64/core-muen_off.mk
Normal file
@ -0,0 +1,17 @@
|
||||
#
|
||||
# \brief Build config for Genodes core process
|
||||
# \author Stefan Kalkowski
|
||||
# \date 2015-06-02
|
||||
#
|
||||
|
||||
# add assembly sources
|
||||
SRC_S += spec/x86_64/kernel/crt0_translation_table.s
|
||||
|
||||
# add C++ sources
|
||||
SRC_CC += spec/x86/kernel/thread.cc
|
||||
SRC_CC += spec/x86/kernel/cpu.cc
|
||||
SRC_CC += spec/x86/pic.cc
|
||||
SRC_CC += spec/x86_64/platform_support.cc
|
||||
|
||||
# include less specific configuration
|
||||
include $(REP_DIR)/lib/mk/x86_64/core.inc
|
20
repos/base-hw/lib/mk/x86_64/core-muen_on.mk
Normal file
20
repos/base-hw/lib/mk/x86_64/core-muen_on.mk
Normal file
@ -0,0 +1,20 @@
|
||||
#
|
||||
# \brief Build config for Genodes core process
|
||||
# \author Stefan Kalkowski
|
||||
# \date 2015-06-02
|
||||
#
|
||||
|
||||
# add include paths
|
||||
INC_DIR += $(REP_DIR)/src/core/include/spec/x86_64/muen
|
||||
|
||||
# add assembly sources
|
||||
SRC_S += spec/x86_64/muen/kernel/crt0_translation_table.s
|
||||
|
||||
# add C++ sources
|
||||
SRC_CC += spec/x86_64/muen/kernel/thread.cc
|
||||
SRC_CC += spec/x86_64/muen/kernel/cpu.cc
|
||||
SRC_CC += spec/x86_64/muen/platform_support.cc
|
||||
SRC_CC += spec/x86_64/muen/sinfo.cc
|
||||
|
||||
# include less specific configuration
|
||||
include $(REP_DIR)/lib/mk/x86_64/core.inc
|
22
repos/base-hw/lib/mk/x86_64/core.inc
Normal file
22
repos/base-hw/lib/mk/x86_64/core.inc
Normal file
@ -0,0 +1,22 @@
|
||||
#
|
||||
# \brief Build config for Genodes core process
|
||||
# \author Stefan Kalkowski
|
||||
# \author Martin Stein
|
||||
# \date 2012-10-04
|
||||
#
|
||||
|
||||
# add include paths
|
||||
INC_DIR += $(REP_DIR)/src/core/include/spec/x86_64
|
||||
|
||||
# add assembly sources
|
||||
SRC_S += spec/x86_64/mode_transition.s
|
||||
SRC_S += spec/x86_64/kernel/crt0.s
|
||||
SRC_S += spec/x86_64/crt0.s
|
||||
|
||||
# add C++ sources
|
||||
SRC_CC += spec/x86_64/kernel/thread_base.cc
|
||||
SRC_CC += spec/x86_64/idt.cc
|
||||
SRC_CC += spec/x86_64/tss.cc
|
||||
|
||||
# include less specific configuration
|
||||
include $(REP_DIR)/lib/mk/x86/core.inc
|
@ -1,25 +1,7 @@
|
||||
#
|
||||
# \brief Build config for Genodes core process
|
||||
# \author Stefan Kalkowski
|
||||
# \author Martin Stein
|
||||
# \date 2012-10-04
|
||||
# \date 2015-06-02
|
||||
#
|
||||
|
||||
# add include paths
|
||||
INC_DIR += $(REP_DIR)/src/core/include/spec/x86_64
|
||||
|
||||
# add assembly sources
|
||||
SRC_S += spec/x86_64/mode_transition.s
|
||||
SRC_S += spec/x86_64/kernel/crt0.s
|
||||
SRC_S += spec/x86_64/kernel/crt0_translation_table.s
|
||||
SRC_S += spec/x86_64/crt0.s
|
||||
|
||||
# add C++ sources
|
||||
SRC_CC += spec/x86/pic.cc
|
||||
SRC_CC += spec/x86_64/kernel/thread_base.cc
|
||||
SRC_CC += spec/x86_64/platform_support.cc
|
||||
SRC_CC += spec/x86_64/idt.cc
|
||||
SRC_CC += spec/x86_64/tss.cc
|
||||
|
||||
# include less specific configuration
|
||||
include $(REP_DIR)/lib/mk/x86/core.inc
|
||||
LIBS += core-muen
|
||||
|
@ -1,3 +0,0 @@
|
||||
include $(REP_DIR)/lib/mk/base-common.inc
|
||||
|
||||
vpath kernel/interface.cc $(REP_DIR)/src/base/x86_64
|
@ -1,35 +0,0 @@
|
||||
#
|
||||
# \brief Build config for Genodes core process
|
||||
# \author Stefan Kalkowski
|
||||
# \author Martin Stein
|
||||
# \date 2012-10-04
|
||||
#
|
||||
|
||||
# add include paths
|
||||
INC_DIR += $(REP_DIR)/src/core/include/spec/x86_64_muen
|
||||
INC_DIR += $(REP_DIR)/src/core/include/spec/x86_64
|
||||
INC_DIR += $(REP_DIR)/src/core/include/spec/x86
|
||||
|
||||
# add assembly sources
|
||||
SRC_S += spec/x86_64/mode_transition.s
|
||||
SRC_S += spec/x86_64/kernel/crt0.s
|
||||
SRC_S += spec/x86_64_muen/kernel/crt0_translation_table.s
|
||||
SRC_S += spec/x86_64/crt0.s
|
||||
|
||||
# add C++ sources
|
||||
SRC_CC += spec/x86_64_muen/platform_support.cc
|
||||
SRC_CC += spec/x86_64_muen/sinfo.cc
|
||||
SRC_CC += spec/x86_64_muen/kernel/thread.cc
|
||||
SRC_CC += spec/x86_64_muen/kernel/cpu.cc
|
||||
SRC_CC += spec/x86_64/kernel/thread_base.cc
|
||||
SRC_CC += spec/x86_64/idt.cc
|
||||
SRC_CC += spec/x86_64/tss.cc
|
||||
SRC_CC += spec/x86/platform_support.cc
|
||||
SRC_CC += spec/x86/kernel/pd.cc
|
||||
SRC_CC += spec/x86/cpu.cc
|
||||
SRC_CC += x86/io_port_session_component.cc
|
||||
SRC_CC += x86/platform_services.cc
|
||||
SRC_CC += kernel/vm_thread.cc
|
||||
|
||||
# include less specific configuration
|
||||
include $(REP_DIR)/lib/mk/core.inc
|
@ -1,19 +1,11 @@
|
||||
#
|
||||
# \brief Build configs that are specific to base-hw/x86_64 on the Muen SK
|
||||
# \author Martin Stein
|
||||
# \date 2011-12-20
|
||||
# \author Reto Buerki
|
||||
# \date 2015-04-14
|
||||
#
|
||||
|
||||
# denote wich specs are also fullfilled by this spec
|
||||
SPECS += hw x86_64_muen
|
||||
SPECS += pci ps2 vesa framebuffer
|
||||
|
||||
# configure multiprocessor mode
|
||||
NR_OF_CPUS = 1
|
||||
|
||||
# set address where to link text segment at
|
||||
LD_TEXT_ADDR ?= 0x200000
|
||||
SPECS += hw_x86_64 muen
|
||||
|
||||
# include implied specs
|
||||
include $(call select_from_repositories,mk/spec-hw.mk)
|
||||
include $(call select_from_repositories,mk/spec-x86_64.mk)
|
||||
include $(call select_from_repositories,mk/spec-hw_x86_64.mk)
|
||||
|
@ -68,7 +68,7 @@ class Genode::Timer
|
||||
_timer_page = (Subject_timer *)region.address;
|
||||
_timer_page->vector = Board::TIMER_VECTOR_KERNEL;
|
||||
PINF("muen-timer: page @0x%llx, frequency %llu kHz, vector %u",
|
||||
region.address, _tics_per_ms, _timer_page->vector);
|
||||
region.address, _tics_per_ms, _timer_page->vector);
|
||||
}
|
||||
|
||||
static unsigned interrupt_id(int)
|
||||
@ -90,7 +90,7 @@ class Genode::Timer
|
||||
{
|
||||
const uint64_t now = rdtsc();
|
||||
if (_timer_page->value != TIMER_DISABLED
|
||||
&& _timer_page->value > now) {
|
||||
&& _timer_page->value > now) {
|
||||
return _timer_page->value - now;
|
||||
}
|
||||
return 0;
|
@ -30,13 +30,14 @@ Cpu_idle::Cpu_idle(Cpu * const cpu) : Cpu_job(Cpu_priority::MIN, 0)
|
||||
|
||||
void Cpu_idle::exception(unsigned const cpu)
|
||||
{
|
||||
if (trapno == RESET) {
|
||||
return;
|
||||
} else if (trapno >= INTERRUPTS_START && trapno <= INTERRUPTS_END) {
|
||||
if (trapno == RESET) return;
|
||||
|
||||
if (trapno >= INTERRUPTS_START && trapno <= INTERRUPTS_END) {
|
||||
pic()->irq_occurred(trapno);
|
||||
_interrupt(cpu);
|
||||
return;
|
||||
}
|
||||
|
||||
PWRN("Unknown exception %lu with error code %lu at ip=%p", trapno,
|
||||
errcode, (void *)ip);
|
||||
assert(0);
|
@ -24,6 +24,7 @@ enum {
|
||||
static const subject_info_type *
|
||||
const sinfo = ((subject_info_type *)SINFO_BASE_ADDR);
|
||||
|
||||
|
||||
/* Log channel information */
|
||||
static bool log_channel(
|
||||
const struct Genode::Sinfo::Channel_info * const channel,
|
||||
@ -31,36 +32,37 @@ static bool log_channel(
|
||||
{
|
||||
if (channel->has_event || channel->has_vector) {
|
||||
PDBG("muen-sinfo: [%s with %s %03d] %s\n",
|
||||
channel->writable ? "writer" : "reader",
|
||||
channel->has_event ? "event " : "vector",
|
||||
channel->has_event ? channel->event_number : channel->vector,
|
||||
channel->name);
|
||||
channel->writable ? "writer" : "reader",
|
||||
channel->has_event ? "event " : "vector",
|
||||
channel->has_event ? channel->event_number : channel->vector,
|
||||
channel->name);
|
||||
} else {
|
||||
PDBG("muen-sinfo: [%s with no %s ] %s\n",
|
||||
channel->writable ? "writer" : "reader",
|
||||
channel->writable ? "event " : "vector",
|
||||
channel->name);
|
||||
channel->writable ? "writer" : "reader",
|
||||
channel->writable ? "event " : "vector",
|
||||
channel->name);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Log memory region information */
|
||||
static bool log_memregion(
|
||||
const struct Genode::Sinfo::Memregion_info * const region,
|
||||
void *data)
|
||||
{
|
||||
PDBG("muen-sinfo: [addr 0x%016llx size 0x%016llx %s%s] %s\n",
|
||||
region->address, region->size,
|
||||
region->writable ? "rw" : "ro",
|
||||
region->executable ? "x" : "-", region->name);
|
||||
region->address, region->size,
|
||||
region->writable ? "rw" : "ro",
|
||||
region->executable ? "x" : "-", region->name);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Fill channel struct with channel information from resource given by index */
|
||||
static void fill_channel_data(
|
||||
uint8_t idx,
|
||||
struct Genode::Sinfo::Channel_info *channel)
|
||||
static void fill_channel_data(uint8_t idx,
|
||||
struct Genode::Sinfo::Channel_info *channel)
|
||||
{
|
||||
const struct resource_type resource = sinfo->resources[idx];
|
||||
const struct memregion_type memregion =
|
||||
@ -81,10 +83,10 @@ static void fill_channel_data(
|
||||
channel->vector = channel_info.vector;
|
||||
}
|
||||
|
||||
|
||||
/* Fill memregion struct with memory region info from resource given by index */
|
||||
static void fill_memregion_data(
|
||||
uint8_t idx,
|
||||
struct Genode::Sinfo::Memregion_info *region)
|
||||
static void fill_memregion_data(uint8_t idx,
|
||||
struct Genode::Sinfo::Memregion_info *region)
|
||||
{
|
||||
const struct resource_type resource = sinfo->resources[idx];
|
||||
const struct memregion_type memregion =
|
||||
@ -99,18 +101,21 @@ static void fill_memregion_data(
|
||||
region->executable = memregion.flags & MEM_EXECUTABLE_FLAG;
|
||||
}
|
||||
|
||||
|
||||
/* Returns true if the given resource is a memory region */
|
||||
static bool is_memregion(const struct resource_type * const resource)
|
||||
{
|
||||
return resource->memregion_idx != NO_RESOURCE;
|
||||
}
|
||||
|
||||
|
||||
/* Returns true if the given resource is a channel */
|
||||
static bool is_channel(const struct resource_type * const resource)
|
||||
{
|
||||
return is_memregion(resource) && resource->channel_info_idx != NO_RESOURCE;
|
||||
}
|
||||
|
||||
|
||||
Sinfo::Sinfo()
|
||||
{
|
||||
if (!check_magic()) {
|
||||
@ -119,20 +124,22 @@ Sinfo::Sinfo()
|
||||
}
|
||||
|
||||
PINF("muen-sinfo: Subject information exports %d memory region(s)\n",
|
||||
sinfo->memregion_count);
|
||||
sinfo->memregion_count);
|
||||
for_each_memregion(log_memregion, 0);
|
||||
PINF("muen-sinfo: Subject information exports %d channel(s)\n",
|
||||
sinfo->channel_info_count);
|
||||
sinfo->channel_info_count);
|
||||
for_each_channel(log_channel, 0);
|
||||
}
|
||||
|
||||
|
||||
bool Sinfo::check_magic(void)
|
||||
{
|
||||
return sinfo != 0 && sinfo->magic == MUEN_SUBJECT_INFO_MAGIC;
|
||||
}
|
||||
|
||||
|
||||
bool Sinfo::get_channel_info(const char * const name,
|
||||
struct Channel_info *channel)
|
||||
struct Channel_info *channel)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -149,8 +156,9 @@ bool Sinfo::get_channel_info(const char * const name,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Sinfo::get_memregion_info(const char * const name,
|
||||
struct Memregion_info *memregion)
|
||||
struct Memregion_info *memregion)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -167,6 +175,7 @@ bool Sinfo::get_memregion_info(const char * const name,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Sinfo::for_each_channel(Channel_cb func, void *data)
|
||||
{
|
||||
int i;
|
||||
@ -185,6 +194,7 @@ bool Sinfo::for_each_channel(Channel_cb func, void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Sinfo::for_each_memregion(Memregion_cb func, void *data)
|
||||
{
|
||||
int i;
|
||||
@ -203,6 +213,7 @@ bool Sinfo::for_each_memregion(Memregion_cb func, void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
uint64_t Sinfo::get_tsc_khz(void)
|
||||
{
|
||||
if (!check_magic())
|
||||
@ -211,6 +222,7 @@ uint64_t Sinfo::get_tsc_khz(void)
|
||||
return sinfo->tsc_khz;
|
||||
}
|
||||
|
||||
|
||||
uint64_t Sinfo::get_sched_start(void)
|
||||
{
|
||||
if (!check_magic())
|
||||
@ -219,6 +231,7 @@ uint64_t Sinfo::get_sched_start(void)
|
||||
return sinfo->tsc_schedule_start;
|
||||
}
|
||||
|
||||
|
||||
uint64_t Sinfo::get_sched_end(void)
|
||||
{
|
||||
if (!check_magic())
|
@ -146,13 +146,13 @@ proc run_boot_dir {binaries} {
|
||||
set elf_img "[run_dir]/image.elf"
|
||||
|
||||
# Use raw binary object for base-hw on Muen
|
||||
if {[have_spec "hw_x86_64_muen"]} {
|
||||
if {[have_spec "muen"]} {
|
||||
set raw_img "[run_dir]/image.raw"
|
||||
exec [cross_dev_prefix]objcopy -O binary bin/$core_bin $raw_img
|
||||
exit 0
|
||||
}
|
||||
|
||||
if {[have_spec "x86_64"]} {
|
||||
if {[have_spec "x86_64"] && ![have_spec "muen"]} {
|
||||
# as startup is done in 32 bit mode, GRUB expects a 32 bit image
|
||||
exec [cross_dev_prefix]objcopy -O elf32-i386 bin/$core_bin $elf_img
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user