diff --git a/repos/base-hw/lib/mk/spec/arm_v6/core.inc b/repos/base-hw/lib/mk/spec/arm_v6/core.inc index 969063fa56..0cedb6ddd4 100644 --- a/repos/base-hw/lib/mk/spec/arm_v6/core.inc +++ b/repos/base-hw/lib/mk/spec/arm_v6/core.inc @@ -13,7 +13,7 @@ SRC_CC += spec/arm_v6/cpu.cc SRC_CC += spec/arm/kernel/cpu_context.cc SRC_CC += spec/arm/kernel/cpu.cc SRC_CC += spec/arm/kernel/thread_update_pd.cc -SRC_CC += kernel/vm_thread.cc +SRC_CC += kernel/vm_thread_off.cc SRC_CC += kernel/kernel.cc # add assembly sources diff --git a/repos/base-hw/lib/mk/spec/arndale/core.mk b/repos/base-hw/lib/mk/spec/arndale/core.mk index fbcb40e1f4..b90ca56e1f 100644 --- a/repos/base-hw/lib/mk/spec/arndale/core.mk +++ b/repos/base-hw/lib/mk/spec/arndale/core.mk @@ -11,7 +11,7 @@ INC_DIR += $(REP_DIR)/src/core/include/spec/arm_v7/virtualization SRC_CC += spec/arndale/cpu.cc SRC_CC += spec/arndale/pic.cc SRC_CC += spec/arndale/platform_services.cc -SRC_CC += spec/arm_v7/kernel/vm_thread.cc +SRC_CC += kernel/vm_thread_on.cc SRC_CC += spec/arm_v7/virtualization/kernel/vm.cc SRC_CC += spec/arm_v7/virtualization/kernel/cpu_context.cc SRC_CC += spec/arm_v7/vm_session_component.cc diff --git a/repos/base-hw/lib/mk/spec/cortex_a9/core.inc b/repos/base-hw/lib/mk/spec/cortex_a9/core.inc index dd78823091..d51cbf8c2e 100644 --- a/repos/base-hw/lib/mk/spec/cortex_a9/core.inc +++ b/repos/base-hw/lib/mk/spec/cortex_a9/core.inc @@ -16,7 +16,7 @@ SRC_CC += spec/arm/smp/kernel/thread_update_pd.cc SRC_CC += spec/arm/smp/kernel/cpu.cc SRC_CC += spec/arm/kernel/cpu_context.cc SRC_CC += spec/arm_gic/pic.cc -SRC_CC += kernel/vm_thread.cc +SRC_CC += kernel/vm_thread_off.cc # add Assembler sources SRC_S += spec/arm/smp/kernel/crt0.s diff --git a/repos/base-hw/lib/mk/spec/imx53/core-trustzone_off.mk b/repos/base-hw/lib/mk/spec/imx53/core-trustzone_off.mk index 8e0872e789..0838f978b8 100644 --- a/repos/base-hw/lib/mk/spec/imx53/core-trustzone_off.mk +++ b/repos/base-hw/lib/mk/spec/imx53/core-trustzone_off.mk @@ -6,7 +6,7 @@ # # add C++ sources -SRC_CC += kernel/vm_thread.cc +SRC_CC += kernel/vm_thread_off.cc SRC_CC += spec/imx53/platform_support.cc SRC_CC += spec/imx53/pic.cc SRC_CC += platform_services.cc diff --git a/repos/base-hw/lib/mk/spec/imx53/core-trustzone_on.inc b/repos/base-hw/lib/mk/spec/imx53/core-trustzone_on.inc index 4be9a5bb9d..6f34c7830c 100644 --- a/repos/base-hw/lib/mk/spec/imx53/core-trustzone_on.inc +++ b/repos/base-hw/lib/mk/spec/imx53/core-trustzone_on.inc @@ -13,7 +13,7 @@ INC_DIR += $(REP_DIR)/src/core/include/spec/imx53/trustzone SRC_CC += spec/imx53/trustzone/platform_support.cc SRC_CC += spec/imx53/trustzone/platform_services.cc SRC_CC += spec/imx53/trustzone/pic.cc -SRC_CC += spec/arm_v7/kernel/vm_thread.cc +SRC_CC += kernel/vm_thread_on.cc SRC_CC += spec/arm_v7/trustzone/kernel/vm.cc SRC_CC += spec/arm_v7/vm_session_component.cc SRC_CC += spec/arm_v7/trustzone/vm_session_component.cc diff --git a/repos/base-hw/lib/mk/spec/odroid_xu/core.mk b/repos/base-hw/lib/mk/spec/odroid_xu/core.mk index b63be2d6fc..13bb653164 100644 --- a/repos/base-hw/lib/mk/spec/odroid_xu/core.mk +++ b/repos/base-hw/lib/mk/spec/odroid_xu/core.mk @@ -8,7 +8,7 @@ SRC_CC += spec/cortex_a15/cpu_init.cc SRC_CC += spec/arm/kernel/cpu_context.cc SRC_CC += spec/arm_gic/pic.cc -SRC_CC += kernel/vm_thread.cc +SRC_CC += kernel/vm_thread_off.cc SRC_CC += platform_services.cc # include less specific configuration diff --git a/repos/base-hw/lib/mk/spec/riscv/core.mk b/repos/base-hw/lib/mk/spec/riscv/core.mk index 88233b8dd9..ecd15799c6 100644 --- a/repos/base-hw/lib/mk/spec/riscv/core.mk +++ b/repos/base-hw/lib/mk/spec/riscv/core.mk @@ -4,7 +4,7 @@ CC_OPT += -fno-delete-null-pointer-checks -msoft-float # add C++ sources SRC_CC += platform_services.cc -SRC_CC += kernel/vm_thread.cc kernel/kernel.cc +SRC_CC += kernel/vm_thread_off.cc kernel/kernel.cc SRC_CC += spec/riscv/kernel/cpu_context.cc SRC_CC += spec/riscv/kernel/thread.cc SRC_CC += spec/riscv/kernel/pd.cc diff --git a/repos/base-hw/lib/mk/spec/x86/core.inc b/repos/base-hw/lib/mk/spec/x86/core.inc index 279a1042af..8d95f41d5a 100644 --- a/repos/base-hw/lib/mk/spec/x86/core.inc +++ b/repos/base-hw/lib/mk/spec/x86/core.inc @@ -10,7 +10,6 @@ INC_DIR += $(BASE_DIR)/../base-hw/src/core/include/spec/x86 # add C++ sources SRC_CC += kernel/kernel.cc -SRC_CC += kernel/vm_thread.cc SRC_CC += spec/x86/kernel/pd.cc SRC_CC += spec/x86/kernel/cpu.cc SRC_CC += spec/x86/kernel/thread.cc @@ -19,7 +18,6 @@ SRC_CC += spec/x86/cpu.cc SRC_CC += spec/x86/fpu.cc SRC_CC += spec/x86/bios_data_area.cc SRC_CC += spec/x86/io_port_session_component.cc -SRC_CC += spec/x86/platform_services.cc # include less specific configuration include $(BASE_DIR)/../base-hw/lib/mk/core.inc diff --git a/repos/base-hw/lib/mk/spec/x86_64/core-muen_off.mk b/repos/base-hw/lib/mk/spec/x86_64/core-muen_off.mk index de7de4990b..1de590b165 100644 --- a/repos/base-hw/lib/mk/spec/x86_64/core-muen_off.mk +++ b/repos/base-hw/lib/mk/spec/x86_64/core-muen_off.mk @@ -8,10 +8,12 @@ SRC_S += spec/x86_64/kernel/crt0_translation_table.s # add C++ sources +SRC_CC += kernel/vm_thread_off.cc SRC_CC += spec/x86/pic.cc SRC_CC += spec/x86/kernel/cpu_exception.cc SRC_CC += spec/x86/kernel/thread_exception.cc SRC_CC += spec/x86_64/platform_support.cc +SRC_CC += spec/x86/platform_services.cc # include less specific configuration include $(REP_DIR)/lib/mk/spec/x86_64/core.inc diff --git a/repos/base-hw/lib/mk/spec/x86_64/core-muen_on.mk b/repos/base-hw/lib/mk/spec/x86_64/core-muen_on.mk index 1c80456f9d..3f29ce81bb 100644 --- a/repos/base-hw/lib/mk/spec/x86_64/core-muen_on.mk +++ b/repos/base-hw/lib/mk/spec/x86_64/core-muen_on.mk @@ -16,6 +16,9 @@ SRC_S += spec/x86_64/muen/kernel/crt0_translation_table.s SRC_CC += spec/x86_64/muen/kernel/cpu_exception.cc SRC_CC += spec/x86_64/muen/kernel/thread_exception.cc SRC_CC += spec/x86_64/muen/platform_support.cc +SRC_CC += spec/x86_64/muen/kernel/vm.cc +SRC_CC += spec/x86_64/muen/platform_services.cc +SRC_CC += kernel/vm_thread_on.cc # include less specific configuration include $(REP_DIR)/lib/mk/spec/x86_64/core.inc diff --git a/repos/base-hw/src/core/include/spec/x86_64/muen/vm_session_component.h b/repos/base-hw/src/core/include/spec/x86_64/muen/vm_session_component.h new file mode 100644 index 0000000000..8f9762c97a --- /dev/null +++ b/repos/base-hw/src/core/include/spec/x86_64/muen/vm_session_component.h @@ -0,0 +1,72 @@ +/* + * \brief Core-specific instance of the VM session interface + * \author Stefan Kalkowski + * \date 2015-06-03 + */ + +/* + * 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 _CORE__INCLUDE__SPEC__X86_64__MUEN__VM_SESSION_COMPONENT_H_ +#define _CORE__INCLUDE__SPEC__X86_64__MUEN__VM_SESSION_COMPONENT_H_ + +/* Genode includes */ +#include +#include +#include +#include + +/* Core includes */ +#include +#include +#include + +namespace Genode { + class Vm_session_component; +} + +class Genode::Vm_session_component +: public Genode::Rpc_object, + public Kernel_object +{ + public: + + Vm_session_component(Rpc_entrypoint*, size_t) { } + ~Vm_session_component() { } + + + /************************** + ** Vm session interface ** + **************************/ + + Dataspace_capability cpu_state(void) { return Dataspace_capability(); } + + void exception_handler(Signal_context_capability handler) + { + if (!create(nullptr, handler.dst(), nullptr)) + PWRN("Cannot instantiate vm kernel object, " + "invalid signal context?"); + } + + void run(void) + { + if (Kernel_object::_cap.valid()) + Kernel::run_vm(kernel_object()); + } + + void pause(void) + { + if (Kernel_object::_cap.valid()) + Kernel::pause_vm(kernel_object()); + } + + void attach(Dataspace_capability ds_cap, addr_t vm_addr) {} + void attach_pic(addr_t vm_addr) {} + void detach(addr_t vm_addr, size_t size) {} +}; + +#endif /* _CORE__INCLUDE__SPEC__X86_64__MUEN__VM_SESSION_COMPONENT_H_ */ diff --git a/repos/base-hw/src/core/include/spec/x86_64/muen/vm_state.h b/repos/base-hw/src/core/include/spec/x86_64/muen/vm_state.h new file mode 100644 index 0000000000..3a729d2682 --- /dev/null +++ b/repos/base-hw/src/core/include/spec/x86_64/muen/vm_state.h @@ -0,0 +1,27 @@ +/* + * \brief CPU context of a virtual machine + * \author Stefan Kalkowski + * \date 2015-06-03 + */ + +/* + * 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 _VM_STATE_H_ +#define _VM_STATE_H_ + +namespace Genode +{ + /** + * Dummy + */ + struct Vm_state { }; + + using Cpu_state_modes = void*; +} + +#endif /* _VM_STATE_H_ */ diff --git a/repos/base-hw/src/core/kernel/vm_thread.cc b/repos/base-hw/src/core/kernel/vm_thread_off.cc similarity index 100% rename from repos/base-hw/src/core/kernel/vm_thread.cc rename to repos/base-hw/src/core/kernel/vm_thread_off.cc diff --git a/repos/base-hw/src/core/spec/arm_v7/kernel/vm_thread.cc b/repos/base-hw/src/core/kernel/vm_thread_on.cc similarity index 100% rename from repos/base-hw/src/core/spec/arm_v7/kernel/vm_thread.cc rename to repos/base-hw/src/core/kernel/vm_thread_on.cc diff --git a/repos/base-hw/src/core/spec/x86_64/muen/kernel/vm.cc b/repos/base-hw/src/core/spec/x86_64/muen/kernel/vm.cc new file mode 100644 index 0000000000..603a673876 --- /dev/null +++ b/repos/base-hw/src/core/spec/x86_64/muen/kernel/vm.cc @@ -0,0 +1,43 @@ +/* + * \brief Kernel backend for virtual machines + * \author Stefan Kalkowski + * \date 2015-06-03 + */ + +/* + * 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. + */ + +#include +#include + +Kernel::Vm::Vm(void * const, Kernel::Signal_context * const context, + void * const) +: Cpu_job(Cpu_priority::MIN, 0), + _state(nullptr), + _context(context), + _table(nullptr) +{ + affinity(cpu_pool()->primary_cpu()); +} + + +Kernel::Vm::~Vm() { } + + +void Kernel::Vm::exception(unsigned const cpu_id) +{ + PDBG("Implement me please"); +} + + +void Kernel::Vm::proceed(unsigned const cpu_id) +{ + PDBG("Implement me please"); +} + + +void Kernel::Vm::inject_irq(unsigned irq) { } diff --git a/repos/base-hw/src/core/spec/x86_64/muen/platform_services.cc b/repos/base-hw/src/core/spec/x86_64/muen/platform_services.cc new file mode 100644 index 0000000000..c16100267a --- /dev/null +++ b/repos/base-hw/src/core/spec/x86_64/muen/platform_services.cc @@ -0,0 +1,41 @@ +/* + * \brief Platform specific services for HW kernel on Muen + * \author Stefan Kalkowski + * \date 2015-06-03 + */ + +/* + * 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. + */ + +/* Genode includes */ +#include + +/* Core includes */ +#include +#include +#include +#include +#include + +/* + * Add I/O port service and virtualization specific vm service + */ +void Genode::platform_add_local_services(Genode::Rpc_entrypoint *ep, + Genode::Sliced_heap *sh, + Genode::Service_registry *ls) +{ + using namespace Genode; + + static Vm_root vm_root(ep, sh); + static Local_service vm_ls(Vm_session::service_name(), &vm_root); + static Io_port_root io_port_root(core_env()->pd_session(), + platform()->io_port_alloc(), sh); + static Local_service io_port_ls(Io_port_session::service_name(), + &io_port_root); + ls->insert(&vm_ls); + ls->insert(&io_port_ls); +}