From dcd20f15664e9a02f4b3a32a1e8f188bf88c0768 Mon Sep 17 00:00:00 2001 From: Reto Buerki Date: Tue, 14 Apr 2015 12:12:15 +0200 Subject: [PATCH] hw: skeleton for building x86_64_muen The hw_x86_64_muen platform is a x86/64 base-hw kernel which runs as isolated subject (guest) on the Muen Separation Kernel (SK) [1]. The platform is implemented as an extension to hw_x86_64 replacing the PIC and timer drivers with paravirtualized variants. The skeleton contains a dummy PIC and timer implementation for now. [1] - http://muen.sk --- .../base-hw/lib/mk/x86_64_muen/base-common.mk | 3 + repos/base-hw/lib/mk/x86_64_muen/core.mk | 34 +++++++++++ repos/base-hw/mk/spec-hw_x86_64_muen.mk | 19 +++++++ .../src/core/include/spec/x86_64_muen/pic.h | 56 +++++++++++++++++++ .../src/core/include/spec/x86_64_muen/timer.h | 46 +++++++++++++++ tool/builddir/etc/build.conf.hw_x86_64_muen | 9 +++ 6 files changed, 167 insertions(+) create mode 100644 repos/base-hw/lib/mk/x86_64_muen/base-common.mk create mode 100644 repos/base-hw/lib/mk/x86_64_muen/core.mk create mode 100644 repos/base-hw/mk/spec-hw_x86_64_muen.mk create mode 100644 repos/base-hw/src/core/include/spec/x86_64_muen/pic.h create mode 100644 repos/base-hw/src/core/include/spec/x86_64_muen/timer.h create mode 100644 tool/builddir/etc/build.conf.hw_x86_64_muen diff --git a/repos/base-hw/lib/mk/x86_64_muen/base-common.mk b/repos/base-hw/lib/mk/x86_64_muen/base-common.mk new file mode 100644 index 000000000..ee9596107 --- /dev/null +++ b/repos/base-hw/lib/mk/x86_64_muen/base-common.mk @@ -0,0 +1,3 @@ +include $(REP_DIR)/lib/mk/base-common.inc + +vpath kernel/interface.cc $(REP_DIR)/src/base/x86_64 diff --git a/repos/base-hw/lib/mk/x86_64_muen/core.mk b/repos/base-hw/lib/mk/x86_64_muen/core.mk new file mode 100644 index 000000000..f0c7b2351 --- /dev/null +++ b/repos/base-hw/lib/mk/x86_64_muen/core.mk @@ -0,0 +1,34 @@ +# +# \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/kernel/crt0_translation_table.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/platform_support.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/thread.cc +SRC_CC += spec/x86/kernel/cpu.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 diff --git a/repos/base-hw/mk/spec-hw_x86_64_muen.mk b/repos/base-hw/mk/spec-hw_x86_64_muen.mk new file mode 100644 index 000000000..6a40c0fef --- /dev/null +++ b/repos/base-hw/mk/spec-hw_x86_64_muen.mk @@ -0,0 +1,19 @@ +# +# \brief Build configs that are specific to base-hw/x86_64 on the Muen SK +# \author Martin Stein +# \date 2011-12-20 +# + +# 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 + +# include implied specs +include $(call select_from_repositories,mk/spec-hw.mk) +include $(call select_from_repositories,mk/spec-x86_64.mk) diff --git a/repos/base-hw/src/core/include/spec/x86_64_muen/pic.h b/repos/base-hw/src/core/include/spec/x86_64_muen/pic.h new file mode 100644 index 000000000..57e57f4e3 --- /dev/null +++ b/repos/base-hw/src/core/include/spec/x86_64_muen/pic.h @@ -0,0 +1,56 @@ +/* + * \brief Programmable interrupt controller for core + * \author Reto Buerki + * \date 2015-04-14 + */ + +/* + * Copyright (C) 2015 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _PIC_H_ +#define _PIC_H_ + +namespace Genode +{ + /** + * Programmable interrupt controller for core + */ + class Pic; +} + +class Genode::Pic +{ + public: + + enum { + /* + * FIXME: dummy ipi value on non-SMP platform, should be removed + * when SMP is an aspect of CPUs only compiled where + * necessary + */ + IPI = 255, + NR_OF_IRQ = 256, + }; + + + /* + * Dummies + */ + Pic() { } + bool take_request(unsigned &irq) { return false; } + void finish_request() { } + void unmask(unsigned const i, unsigned) { } + void mask(unsigned const i) { } + void mask() { } + void init_cpu_local() { } + bool is_ip_interrupt(unsigned, unsigned) { return false; } + void trigger_ip_interrupt(unsigned) { } +}; + +namespace Kernel { class Pic : public Genode::Pic { }; } + +#endif /* _PIC_H_ */ diff --git a/repos/base-hw/src/core/include/spec/x86_64_muen/timer.h b/repos/base-hw/src/core/include/spec/x86_64_muen/timer.h new file mode 100644 index 000000000..e5e3c4b23 --- /dev/null +++ b/repos/base-hw/src/core/include/spec/x86_64_muen/timer.h @@ -0,0 +1,46 @@ +/* + * \brief Timer driver for core + * \author Reto Buerki + * \date 2015-04-14 + */ + +/* + * Copyright (C) 2015 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _TIMER_H_ +#define _TIMER_H_ + +#include + +namespace Genode +{ + /** + * Timer driver for core on Muen + */ + class Timer; +} + +class Genode::Timer +{ + public: + + Timer() { } + + static unsigned interrupt_id(int) { return 0; } + + inline void start_one_shot(uint32_t const tics, unsigned) { } + + uint32_t ms_to_tics(unsigned const ms) { return 0; } + + unsigned value(unsigned) { return 0; } + + static void disable_pit(void) { } +}; + +namespace Kernel { class Timer : public Genode::Timer { }; } + +#endif /* _TIMER_H_ */ diff --git a/tool/builddir/etc/build.conf.hw_x86_64_muen b/tool/builddir/etc/build.conf.hw_x86_64_muen new file mode 100644 index 000000000..54a3c309b --- /dev/null +++ b/tool/builddir/etc/build.conf.hw_x86_64_muen @@ -0,0 +1,9 @@ +REPOSITORIES += $(GENODE_DIR)/repos/base-hw + +## +## Kernel-specific run tool configuration +## + +RUN_OPT = --include boot_dir/hw \ + --include power_on/qemu --include log/qemu --include image/iso +