hw_x86_64_muen: implement VM service skeleton

Issue #2016
This commit is contained in:
Stefan Kalkowski 2015-06-03 11:07:39 +02:00 committed by Norman Feske
parent 8188e60954
commit e5e1f1261f
16 changed files with 195 additions and 9 deletions

View File

@ -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_context.cc
SRC_CC += spec/arm/kernel/cpu.cc SRC_CC += spec/arm/kernel/cpu.cc
SRC_CC += spec/arm/kernel/thread_update_pd.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 SRC_CC += kernel/kernel.cc
# add assembly sources # add assembly sources

View File

@ -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/cpu.cc
SRC_CC += spec/arndale/pic.cc SRC_CC += spec/arndale/pic.cc
SRC_CC += spec/arndale/platform_services.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/vm.cc
SRC_CC += spec/arm_v7/virtualization/kernel/cpu_context.cc SRC_CC += spec/arm_v7/virtualization/kernel/cpu_context.cc
SRC_CC += spec/arm_v7/vm_session_component.cc SRC_CC += spec/arm_v7/vm_session_component.cc

View File

@ -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/smp/kernel/cpu.cc
SRC_CC += spec/arm/kernel/cpu_context.cc SRC_CC += spec/arm/kernel/cpu_context.cc
SRC_CC += spec/arm_gic/pic.cc SRC_CC += spec/arm_gic/pic.cc
SRC_CC += kernel/vm_thread.cc SRC_CC += kernel/vm_thread_off.cc
# add Assembler sources # add Assembler sources
SRC_S += spec/arm/smp/kernel/crt0.s SRC_S += spec/arm/smp/kernel/crt0.s

View File

@ -6,7 +6,7 @@
# #
# add C++ sources # 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/platform_support.cc
SRC_CC += spec/imx53/pic.cc SRC_CC += spec/imx53/pic.cc
SRC_CC += platform_services.cc SRC_CC += platform_services.cc

View File

@ -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_support.cc
SRC_CC += spec/imx53/trustzone/platform_services.cc SRC_CC += spec/imx53/trustzone/platform_services.cc
SRC_CC += spec/imx53/trustzone/pic.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/trustzone/kernel/vm.cc
SRC_CC += spec/arm_v7/vm_session_component.cc SRC_CC += spec/arm_v7/vm_session_component.cc
SRC_CC += spec/arm_v7/trustzone/vm_session_component.cc SRC_CC += spec/arm_v7/trustzone/vm_session_component.cc

View File

@ -8,7 +8,7 @@
SRC_CC += spec/cortex_a15/cpu_init.cc SRC_CC += spec/cortex_a15/cpu_init.cc
SRC_CC += spec/arm/kernel/cpu_context.cc SRC_CC += spec/arm/kernel/cpu_context.cc
SRC_CC += spec/arm_gic/pic.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 SRC_CC += platform_services.cc
# include less specific configuration # include less specific configuration

View File

@ -4,7 +4,7 @@ CC_OPT += -fno-delete-null-pointer-checks -msoft-float
# add C++ sources # add C++ sources
SRC_CC += platform_services.cc 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/cpu_context.cc
SRC_CC += spec/riscv/kernel/thread.cc SRC_CC += spec/riscv/kernel/thread.cc
SRC_CC += spec/riscv/kernel/pd.cc SRC_CC += spec/riscv/kernel/pd.cc

View File

@ -10,7 +10,6 @@ INC_DIR += $(BASE_DIR)/../base-hw/src/core/include/spec/x86
# add C++ sources # add C++ sources
SRC_CC += kernel/kernel.cc SRC_CC += kernel/kernel.cc
SRC_CC += kernel/vm_thread.cc
SRC_CC += spec/x86/kernel/pd.cc SRC_CC += spec/x86/kernel/pd.cc
SRC_CC += spec/x86/kernel/cpu.cc SRC_CC += spec/x86/kernel/cpu.cc
SRC_CC += spec/x86/kernel/thread.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/fpu.cc
SRC_CC += spec/x86/bios_data_area.cc SRC_CC += spec/x86/bios_data_area.cc
SRC_CC += spec/x86/io_port_session_component.cc SRC_CC += spec/x86/io_port_session_component.cc
SRC_CC += spec/x86/platform_services.cc
# include less specific configuration # include less specific configuration
include $(BASE_DIR)/../base-hw/lib/mk/core.inc include $(BASE_DIR)/../base-hw/lib/mk/core.inc

View File

@ -8,10 +8,12 @@
SRC_S += spec/x86_64/kernel/crt0_translation_table.s SRC_S += spec/x86_64/kernel/crt0_translation_table.s
# add C++ sources # add C++ sources
SRC_CC += kernel/vm_thread_off.cc
SRC_CC += spec/x86/pic.cc SRC_CC += spec/x86/pic.cc
SRC_CC += spec/x86/kernel/cpu_exception.cc SRC_CC += spec/x86/kernel/cpu_exception.cc
SRC_CC += spec/x86/kernel/thread_exception.cc SRC_CC += spec/x86/kernel/thread_exception.cc
SRC_CC += spec/x86_64/platform_support.cc SRC_CC += spec/x86_64/platform_support.cc
SRC_CC += spec/x86/platform_services.cc
# include less specific configuration # include less specific configuration
include $(REP_DIR)/lib/mk/spec/x86_64/core.inc include $(REP_DIR)/lib/mk/spec/x86_64/core.inc

View File

@ -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/cpu_exception.cc
SRC_CC += spec/x86_64/muen/kernel/thread_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/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 less specific configuration
include $(REP_DIR)/lib/mk/spec/x86_64/core.inc include $(REP_DIR)/lib/mk/spec/x86_64/core.inc

View File

@ -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 <base/allocator.h>
#include <base/rpc_server.h>
#include <vm_session/vm_session.h>
#include <dataspace/capability.h>
/* Core includes */
#include <dataspace_component.h>
#include <object.h>
#include <kernel/vm.h>
namespace Genode {
class Vm_session_component;
}
class Genode::Vm_session_component
: public Genode::Rpc_object<Genode::Vm_session>,
public Kernel_object<Kernel::Vm>
{
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<Kernel::Vm>::_cap.valid())
Kernel::run_vm(kernel_object());
}
void pause(void)
{
if (Kernel_object<Kernel::Vm>::_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_ */

View File

@ -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_ */

View File

@ -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 <platform_pd.h>
#include <kernel/vm.h>
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) { }

View File

@ -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 <base/service.h>
/* Core includes */
#include <core_env.h>
#include <platform.h>
#include <platform_services.h>
#include <vm_root.h>
#include <io_port_root.h>
/*
* 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);
}