mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
seoul: use vm_session interface
and remove any dependency on the NOVA kernel interface Issue #3111
This commit is contained in:
parent
35d46dca72
commit
8840ca96a9
@ -1 +1 @@
|
||||
4f2b4e390088d7ad3ba10767feaaaa4c7a06a407
|
||||
66a1a29b0ee5e2407cb27b46fb515b0d1a0d951f
|
||||
|
@ -4,7 +4,7 @@ DOWNLOADS := seoul.git
|
||||
|
||||
URL(seoul) := https://github.com/alex-ab/seoul.git
|
||||
# branch PARAM
|
||||
REV(seoul) := ca77327faaed6f15c8660f24dd9f7b805dae107e
|
||||
REV(seoul) := de0192662cfeda6b6dfcdaaf667ba652c1c5b282
|
||||
DIR(seoul) := src/app/seoul
|
||||
|
||||
#
|
||||
|
@ -1 +0,0 @@
|
||||
2019-04-07 e7f2264b59d1dd9d69e11819e8ec617d74af1981
|
@ -16,13 +16,12 @@ BASE_SRC_INCLUDE := src/include/base/internal/crt0.h \
|
||||
|
||||
src/include:
|
||||
mkdir -p $@/base/internal
|
||||
cp -r $(GENODE_DIR)/repos/base-nova/$@ $(dir $@)
|
||||
for file in $(BASE_SRC_INCLUDE); do \
|
||||
cp $(GENODE_DIR)/repos/base/$$file $$file; \
|
||||
done
|
||||
|
||||
MIRROR_FROM_PORT_DIR := lib/mk/seoul_libc_support.mk \
|
||||
include/vmm
|
||||
include/vmm/types.h
|
||||
|
||||
content: $(MIRROR_FROM_PORT_DIR)
|
||||
|
||||
@ -39,17 +38,7 @@ $(MIRROR_FROM_LIBPORTS):
|
||||
mkdir -p $(dir $@)
|
||||
cp -r $(GENODE_DIR)/repos/libports/$@ $(dir $@)
|
||||
|
||||
MIRROR_FROM_BASE_NOVA := lib/mk/base-nova-common.mk \
|
||||
lib/mk/base-nova.mk \
|
||||
lib/mk/spec/x86_32/startup-nova.mk \
|
||||
lib/mk/spec/x86_64/startup-nova.mk \
|
||||
src/lib/base
|
||||
|
||||
content: $(MIRROR_FROM_BASE_NOVA)
|
||||
|
||||
$(MIRROR_FROM_BASE_NOVA):
|
||||
mkdir -p $(dir $@)
|
||||
cp -r $(GENODE_DIR)/repos/base-nova/$@ $(dir $@)
|
||||
content:
|
||||
|
||||
MIRROR_FROM_BASE := lib/mk/cxx.mk
|
||||
|
1
repos/ports/recipes/src/seoul/hash
Normal file
1
repos/ports/recipes/src/seoul/hash
Normal file
@ -0,0 +1 @@
|
||||
2019-04-16 98cd72a468efeca8d679a35ea9a5b6c92038a8fc
|
@ -1,4 +1,3 @@
|
||||
base-nova
|
||||
base
|
||||
libc
|
||||
os
|
@ -7,13 +7,19 @@
|
||||
# It assumes that the module files are present at '<build-dir>/bin/'
|
||||
#
|
||||
|
||||
assert_spec nova
|
||||
assert_spec x86
|
||||
|
||||
if { [get_cmd_switch --autopilot] && ![have_include "power_on/qemu"] && [have_spec x86_32] } {
|
||||
puts "Run script does not support autopilot mode on 32 bit"
|
||||
exit 0
|
||||
}
|
||||
|
||||
if {[have_spec foc] || [have_spec sel4] || [have_spec nova]} {
|
||||
} else {
|
||||
puts "\n Run script is not supported on this platform. \n";
|
||||
exit 0
|
||||
}
|
||||
|
||||
set use_multiboot 1
|
||||
set use_genode_iso 0
|
||||
set use_model_ahci 0
|
||||
@ -35,6 +41,11 @@ set memory_vmm_vm "128M"
|
||||
|
||||
set vcpus_to_be_used 2
|
||||
|
||||
if {[have_spec sel4]} {
|
||||
# The seL4 kernel dies with an exception XXX
|
||||
set vcpus_to_be_used 1
|
||||
}
|
||||
|
||||
set multiboot_files {
|
||||
<rom name="munich"/>
|
||||
<rom name="bzImage-3.1" cmdline="root=/dev/ram0 earlyprintk=ttyS0 console=ttyS0 text"/>
|
||||
@ -64,7 +75,11 @@ append qemu_args " -cpu phenom "
|
||||
append qemu_args " -net nic,model=e1000 "
|
||||
append qemu_args " -nographic "
|
||||
|
||||
run_genode_until {\[init -\> seoul\] VMM: # Hello Genode world!} 300
|
||||
if { [get_cmd_switch --autopilot] } {
|
||||
run_genode_until {\[init -\> seoul\] VMM: # Hello Genode world!} 300
|
||||
} else {
|
||||
run_genode_until forever
|
||||
}
|
||||
|
||||
foreach binary $guest_os_binaries {
|
||||
exec rm -f bin/$binary
|
||||
|
@ -23,7 +23,7 @@ set use_usb 0
|
||||
|
||||
set use_framebuffer 1
|
||||
set use_fancy_stuff 0
|
||||
set use_top 0
|
||||
set use_top 1
|
||||
|
||||
set memory_vmm_vm "128M"
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
# It assumes that the module files are present at '<build-dir>/bin/'
|
||||
#
|
||||
|
||||
assert_spec nova
|
||||
assert_spec x86
|
||||
|
||||
if {[have_include power_on/qemu]} {
|
||||
puts "\nAuto test running on Qemu is not recommended.\n"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# \brief Using Vancouver/Seoul on Genode
|
||||
# \brief Using Seoul on Genode
|
||||
# \author Norman Feske
|
||||
# \author Markus Partheymueller
|
||||
# \author Alexander Boettcher
|
||||
@ -14,12 +14,31 @@ import_from_depot [depot_user]/src/[base_src] \
|
||||
# Build
|
||||
#
|
||||
|
||||
if {![have_spec nova]} {
|
||||
puts "\nSeoul is solely supported on NOVA.\n"
|
||||
exit 0
|
||||
assert_spec x86
|
||||
|
||||
set rdtsc_exit "no"
|
||||
set map_small "no"
|
||||
|
||||
if {[have_spec sel4]} {
|
||||
set map_small "yes"
|
||||
set rdtsc_exit "yes"
|
||||
|
||||
# seL4 has no AMD SVM support
|
||||
if {[have_include "power_on/qemu"]} {
|
||||
puts "\n Run script is not supported on this platform. \n";
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
|
||||
assert_spec acpi
|
||||
if {[have_spec foc]} {
|
||||
set rdtsc_exit yes
|
||||
|
||||
# Qemu SVM has no EPT support
|
||||
if {[have_include "power_on/qemu"]} {
|
||||
puts "\n Run script is not supported on this platform. \n";
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
|
||||
source ${genode_dir}/repos/base/run/platform_drv.inc
|
||||
# override defaults of platform_drv.inc
|
||||
@ -52,8 +71,8 @@ build $build_components
|
||||
|
||||
# write Seoul config file
|
||||
set vm_cfg_fd [open "bin/vm_seoul.cfg" w]
|
||||
puts $vm_cfg_fd {<config colocate="1" >
|
||||
<machine>
|
||||
puts $vm_cfg_fd "<config map_small=\"$map_small\" exit_on_rdtsc=\"$rdtsc_exit\">"
|
||||
puts $vm_cfg_fd { <machine>
|
||||
<mem start="0x0" end="0x9a000"/>
|
||||
<mem start="0x100000" end="0xfffff000"/>
|
||||
<!--<ioio/>-->
|
||||
@ -151,6 +170,7 @@ append config {
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="VM"/>
|
||||
<service name="LOG"/>}
|
||||
|
||||
append_if $use_top config {
|
||||
@ -234,20 +254,24 @@ append_if [expr $use_nic_session && $use_nic_bridge] config {
|
||||
}
|
||||
|
||||
append_if $use_framebuffer config {
|
||||
<start name="fb_drv" priority="-1" caps="120">
|
||||
<start name="fb_drv" priority="-1" caps="130">
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
<route>
|
||||
<service name="Timer"><child name="timer"/></service>
|
||||
<service name="Platform"><any-child/></service>
|
||||
<any-service><parent/></any-service>
|
||||
</route>
|
||||
<config width="1280" height="1024" depth="16" buffered="yes"/>
|
||||
</route>}
|
||||
append_if [expr $use_framebuffer && [have_include "power_on/qemu"]] config {
|
||||
<config width="1280" height="960" depth="16" buffered="yes"/>}
|
||||
append_if [expr $use_framebuffer && ![have_include "power_on/qemu"]] config {
|
||||
<config buffered="yes"/>}
|
||||
append_if $use_framebuffer config {
|
||||
</start> }
|
||||
|
||||
if {!$use_fancy_stuff} {
|
||||
append config {
|
||||
<start name="seoul" priority="-3" caps="200" ld="no">
|
||||
<start name="seoul" priority="-3" caps="400">
|
||||
<binary name="seoul"/>}
|
||||
append config "
|
||||
<resource name=\"RAM\" quantum=\"$memory_vmm_vm\"/>"
|
||||
@ -260,6 +284,7 @@ append_if [expr $use_nic_session && !$use_nic_bridge] config {
|
||||
<service name="Nic"> <child name="nic_drv"/> </service>}
|
||||
append_if $use_genode_iso config {
|
||||
<service name="ROM" unscoped_label="seoul"> <parent/> </service>
|
||||
<service name="ROM" unscoped_label="ld.lib.so"> <parent/> </service>
|
||||
<service name="ROM" label="vm_seoul.cfg"> <parent/> </service>
|
||||
<service name="ROM" label="platform_info"> <parent/> </service>
|
||||
<service name="ROM"><child name="iso9660"/></service>}
|
||||
@ -281,7 +306,7 @@ append_if $use_usb config {
|
||||
</start>}
|
||||
|
||||
append config {
|
||||
<start name="nitpicker" priority="-1">
|
||||
<start name="nitpicker" priority="-1" caps="120">
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<config>
|
||||
<report focus="yes" />
|
||||
@ -314,7 +339,7 @@ append config {
|
||||
</start>
|
||||
|
||||
<start name="pointer">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
</start>
|
||||
|
||||
<start name="report_rom">
|
||||
@ -325,6 +350,12 @@ append config {
|
||||
</config>
|
||||
</start>}
|
||||
|
||||
append_if $use_top config {
|
||||
<start name="top">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<config period_ms="10000"/>
|
||||
</start>}
|
||||
|
||||
append_if $use_fancy_stuff config {
|
||||
<start name="status_bar">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
@ -342,12 +373,6 @@ append_if $use_fancy_stuff config {
|
||||
</route>
|
||||
</start>}
|
||||
|
||||
append_if $use_top config {
|
||||
<start name="top">
|
||||
<resource name="RAM" quantum="2M"/>
|
||||
<config period_ms="10000"/>
|
||||
</start>}
|
||||
|
||||
append config {
|
||||
</config>}
|
||||
|
||||
@ -376,9 +401,10 @@ if {$use_fancy_stuff} {
|
||||
<service name="Nic"/>
|
||||
<service name="Block"/>
|
||||
<service name="Rtc"/>
|
||||
<service name="VM"/>
|
||||
</parent-provides>
|
||||
|
||||
<start name="seoul" priority="-1" caps="200" ld="no">
|
||||
<start name="seoul" priority="-1" caps="200">
|
||||
<binary name="seoul"/>
|
||||
<resource name="RAM" quantum="256M"/>
|
||||
<route>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -134,6 +134,11 @@ unsigned Seoul::Console::_input_to_ps2mouse(Input::Event const &ev)
|
||||
return packet;
|
||||
}
|
||||
|
||||
enum {
|
||||
PHYS_FRAME_VGA = 0xa0,
|
||||
PHYS_FRAME_VGA_COLOR = 0xb8,
|
||||
FRAME_COUNT_COLOR = 0x8
|
||||
};
|
||||
|
||||
unsigned Seoul::Console::_input_to_ps2wheel(Input::Event const &ev)
|
||||
{
|
||||
@ -175,8 +180,8 @@ bool Seoul::Console::receive(MessageConsole &msg)
|
||||
msg.info->bytes_scanline = 80*2;
|
||||
msg.info->bpp = 4;
|
||||
msg.info->memory_model = MEMORY_MODEL_TEXT;
|
||||
msg.info->phys_base = 0xb8000;
|
||||
msg.info->_phys_size = 0x8000;
|
||||
msg.info->phys_base = PHYS_FRAME_VGA_COLOR << 12;
|
||||
msg.info->_phys_size = FRAME_COUNT_COLOR << 12;
|
||||
return true;
|
||||
|
||||
} else if (msg.index == 1) {
|
||||
@ -218,7 +223,8 @@ void Screen::vga_updated()
|
||||
bool Seoul::Console::receive(MessageMemRegion &msg)
|
||||
{
|
||||
/* we had a fault in the text framebuffer */
|
||||
bool reactivate = (msg.page >= 0xb8 && msg.page <= 0xbf);
|
||||
bool reactivate = (msg.page >= PHYS_FRAME_VGA_COLOR &&
|
||||
msg.page < PHYS_FRAME_VGA_COLOR + FRAME_COUNT_COLOR);
|
||||
|
||||
/* vga memory got changed indirectly by vbios */
|
||||
if (fb_state.vga_update) {
|
||||
@ -290,8 +296,8 @@ unsigned Seoul::Console::_handle_fb()
|
||||
return fb_state.unchanged * 30;
|
||||
|
||||
/* if we copy the same data 10 times, unmap the text buffer from guest */
|
||||
_env.rm().detach((void *)_guest_fb);
|
||||
_env.rm().attach_at(_guest_fb_ds, (Genode::addr_t)_guest_fb);
|
||||
_memory.detach(PHYS_FRAME_VGA_COLOR << 12,
|
||||
FRAME_COUNT_COLOR << 12);
|
||||
|
||||
fb_state.unchanged = 0;
|
||||
fb_state.active = false;
|
||||
@ -303,12 +309,12 @@ unsigned Seoul::Console::_handle_fb()
|
||||
|
||||
if (!fb_state.revoked) {
|
||||
|
||||
_env.rm().detach((void *)_guest_fb);
|
||||
_env.rm().attach_at(_framebuffer.dataspace(),
|
||||
(Genode::addr_t)_guest_fb);
|
||||
_memory.detach(PHYS_FRAME_VGA_COLOR << 12,
|
||||
FRAME_COUNT_COLOR << 12);
|
||||
|
||||
fb_state.revoked = true;
|
||||
}
|
||||
|
||||
_framebuffer.refresh(0, 0, _fb_mode.width(), _fb_mode.height());
|
||||
return 10;
|
||||
}
|
||||
@ -371,23 +377,33 @@ bool Seoul::Console::receive(MessageTimeout &msg) {
|
||||
}
|
||||
|
||||
|
||||
Seoul::Console::Console(Genode::Env &env, Synced_motherboard &mb,
|
||||
Seoul::Console::Console(Genode::Env &env, Genode::Allocator &alloc,
|
||||
Synced_motherboard &mb,
|
||||
Motherboard &unsynchronized_motherboard,
|
||||
Nitpicker::Connection &nitpicker,
|
||||
Genode::Dataspace_capability guest_fb_ds)
|
||||
Seoul::Guest_memory &guest_memory)
|
||||
:
|
||||
_env(env),
|
||||
_unsynchronized_motherboard(unsynchronized_motherboard),
|
||||
_motherboard(mb),
|
||||
_framebuffer(*nitpicker.framebuffer()),
|
||||
_input(*nitpicker.input()),
|
||||
_guest_fb_ds(guest_fb_ds),
|
||||
_memory(guest_memory),
|
||||
_fb_ds(_framebuffer.dataspace()),
|
||||
_fb_mode(_framebuffer.mode()),
|
||||
_fb_size(Genode::Dataspace_client(_framebuffer.dataspace()).size()),
|
||||
_pixels(_env.rm().attach(_framebuffer.dataspace())),
|
||||
_fb_size(Genode::Dataspace_client(_fb_ds).size()),
|
||||
_fb_vm_ds(env.ram().alloc(_fb_size)),
|
||||
_fb_vm_mapping(_env.rm().attach(_fb_vm_ds)),
|
||||
_vm_phys_fb(guest_memory.alloc_io_memory(_fb_size)),
|
||||
_pixels(_env.rm().attach(_fb_ds)),
|
||||
_surface(reinterpret_cast<Genode::Pixel_rgb565 *>(_pixels),
|
||||
Genode::Surface_base::Area(_fb_mode.width(),
|
||||
_fb_mode.height()))
|
||||
{
|
||||
guest_memory.add_region(alloc, PHYS_FRAME_VGA << 12,
|
||||
_fb_vm_mapping, _fb_vm_ds, _fb_size);
|
||||
guest_memory.add_region(alloc, _vm_phys_fb,
|
||||
Genode::addr_t(_pixels), _fb_ds, _fb_size);
|
||||
|
||||
_input.sigh(_signal_input);
|
||||
}
|
||||
|
@ -38,10 +38,12 @@
|
||||
/* local includes */
|
||||
#include "keyboard.h"
|
||||
#include "synced_motherboard.h"
|
||||
#include "guest_memory.h"
|
||||
|
||||
namespace Seoul {
|
||||
class Console;
|
||||
using Genode::Pixel_rgb565;
|
||||
using Genode::Dataspace_capability;
|
||||
}
|
||||
|
||||
class Seoul::Console : public StaticReceiver<Seoul::Console>
|
||||
@ -53,9 +55,13 @@ class Seoul::Console : public StaticReceiver<Seoul::Console>
|
||||
Synced_motherboard &_motherboard;
|
||||
Framebuffer::Session &_framebuffer;
|
||||
Input::Session_client &_input;
|
||||
Genode::Dataspace_capability _guest_fb_ds;
|
||||
Framebuffer::Mode _fb_mode;
|
||||
size_t _fb_size;
|
||||
Seoul::Guest_memory &_memory;
|
||||
Dataspace_capability const _fb_ds;
|
||||
Framebuffer::Mode const _fb_mode;
|
||||
size_t const _fb_size;
|
||||
Dataspace_capability const _fb_vm_ds;
|
||||
Genode::addr_t const _fb_vm_mapping;
|
||||
Genode::addr_t const _vm_phys_fb;
|
||||
short *_pixels;
|
||||
Genode::Surface<Pixel_rgb565> _surface;
|
||||
Keyboard _vkeyb { _motherboard };
|
||||
@ -83,6 +89,10 @@ class Seoul::Console : public StaticReceiver<Seoul::Console>
|
||||
|
||||
public:
|
||||
|
||||
Genode::addr_t attached_framebuffer() const { return _fb_vm_mapping; }
|
||||
Genode::addr_t framebuffer_size() const { return _fb_size; }
|
||||
Genode::addr_t vm_phys_framebuffer() const { return _vm_phys_fb; }
|
||||
|
||||
/* bus callbacks */
|
||||
bool receive(MessageConsole &);
|
||||
bool receive(MessageMemRegion &);
|
||||
@ -93,8 +103,9 @@ class Seoul::Console : public StaticReceiver<Seoul::Console>
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Console(Genode::Env &env, Synced_motherboard &, Motherboard &,
|
||||
Nitpicker::Connection &, Genode::Dataspace_capability fb_ds);
|
||||
Console(Genode::Env &env, Genode::Allocator &alloc,
|
||||
Synced_motherboard &, Motherboard &,
|
||||
Nitpicker::Connection &, Seoul::Guest_memory &);
|
||||
};
|
||||
|
||||
#endif /* _CONSOLE_H_ */
|
||||
|
@ -24,9 +24,6 @@
|
||||
#include <block_session/connection.h>
|
||||
#include <base/heap.h>
|
||||
|
||||
/* VMM utility includes */
|
||||
#include <vmm/utcb_guard.h>
|
||||
|
||||
/* local includes */
|
||||
#include "disk.h"
|
||||
|
||||
@ -156,9 +153,6 @@ void Seoul::Disk::handle_disk(unsigned disknr)
|
||||
|
||||
bool Seoul::Disk::receive(MessageDisk &msg)
|
||||
{
|
||||
static Vmm::Utcb_guard::Utcb_backup utcb_backup;
|
||||
Vmm::Utcb_guard guard(utcb_backup);
|
||||
|
||||
if (msg.disknr >= MAX_DISKS)
|
||||
Logging::panic("You configured more disks than supported.\n");
|
||||
|
||||
|
174
repos/ports/src/app/seoul/guest_memory.h
Normal file
174
repos/ports/src/app/seoul/guest_memory.h
Normal file
@ -0,0 +1,174 @@
|
||||
/*
|
||||
* \brief Seoul Guest memory management
|
||||
* \author Alexander Boettcher
|
||||
* \author Norman Feske
|
||||
* \author Markus Partheymueller
|
||||
* \date 2011-11-18
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2019 Genode Labs GmbH
|
||||
* Copyright (C) 2012 Intel Corporation
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*
|
||||
* The code is partially based on the Vancouver VMM, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _GUEST_MEMORY_H_
|
||||
#define _GUEST_MEMORY_H_
|
||||
|
||||
#include <rm_session/connection.h>
|
||||
#include <vm_session/connection.h>
|
||||
#include <region_map/client.h>
|
||||
|
||||
namespace Seoul { class Guest_memory; }
|
||||
|
||||
class Seoul::Guest_memory
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Env &_env;
|
||||
Genode::Vm_connection &_vm_con;
|
||||
|
||||
Genode::Ram_dataspace_capability _ds;
|
||||
|
||||
Genode::size_t const _backing_store_size;
|
||||
Genode::addr_t _io_mem_alloc;
|
||||
Genode::addr_t const _local_addr;
|
||||
|
||||
/*
|
||||
* Noncopyable
|
||||
*/
|
||||
Guest_memory(Guest_memory const &);
|
||||
Guest_memory &operator = (Guest_memory const &);
|
||||
|
||||
struct Region : Genode::List<Region>::Element {
|
||||
Genode::addr_t _guest_addr;
|
||||
Genode::addr_t _local_addr;
|
||||
Genode::Dataspace_capability _ds;
|
||||
Genode::addr_t _ds_size;
|
||||
|
||||
Region (Genode::addr_t const guest_addr,
|
||||
Genode::addr_t const local_addr,
|
||||
Genode::Dataspace_capability ds,
|
||||
Genode::addr_t const ds_size)
|
||||
: _guest_addr(guest_addr), _local_addr(local_addr),
|
||||
_ds(ds), _ds_size(ds_size)
|
||||
{ }
|
||||
};
|
||||
|
||||
Genode::List<Region> _regions { };
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Number of bytes that are available to the guest
|
||||
*
|
||||
* At startup time, some device models (i.e., the VGA controller) claim
|
||||
* a bit of guest-physical memory for their respective devices (i.e.,
|
||||
* the virtual frame buffer) by calling 'OP_ALLOC_FROM_GUEST'. This
|
||||
* function allocates such blocks from the end of the backing store.
|
||||
* The 'remaining_size' contains the number of bytes left at the lower
|
||||
* part of the backing store for the use as normal guest-physical RAM.
|
||||
* It is initialized with the actual backing store size and then
|
||||
* managed by the 'OP_ALLOC_FROM_GUEST' handler.
|
||||
*/
|
||||
Genode::size_t remaining_size;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param backing_store_size number of bytes of physical RAM to be
|
||||
* used as guest-physical and device memory,
|
||||
* allocated from core's RAM service
|
||||
*/
|
||||
Guest_memory(Genode::Env &env, Genode::Allocator &alloc,
|
||||
Genode::Vm_connection &vm_con,
|
||||
Genode::size_t backing_store_size)
|
||||
:
|
||||
_env(env), _vm_con(vm_con),
|
||||
_ds(env.ram().alloc(backing_store_size)),
|
||||
_backing_store_size(backing_store_size),
|
||||
_io_mem_alloc(backing_store_size),
|
||||
_local_addr(env.rm().attach(_ds)),
|
||||
remaining_size(backing_store_size)
|
||||
{
|
||||
/* free region for attaching it executable */
|
||||
env.rm().detach(_local_addr);
|
||||
|
||||
/*
|
||||
* RAM used as backing store for guest-physical memory
|
||||
*/
|
||||
env.rm().attach_executable(_ds, _local_addr);
|
||||
|
||||
/* register ds for VM region */
|
||||
add_region(alloc, 0UL, _local_addr, _ds, remaining_size);
|
||||
}
|
||||
|
||||
~Guest_memory()
|
||||
{
|
||||
/* detach and free backing store */
|
||||
_env.rm().detach((void *)_local_addr);
|
||||
_env.ram().free(_ds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return pointer to locally mapped backing store
|
||||
*/
|
||||
char *backing_store_local_base()
|
||||
{
|
||||
return reinterpret_cast<char *>(_local_addr);
|
||||
}
|
||||
|
||||
Genode::size_t backing_store_size()
|
||||
{
|
||||
return _backing_store_size;
|
||||
}
|
||||
|
||||
void add_region(Genode::Allocator &alloc,
|
||||
Genode::addr_t const guest_addr,
|
||||
Genode::addr_t const local_addr,
|
||||
Genode::Dataspace_capability ds,
|
||||
Genode::addr_t const ds_size)
|
||||
{
|
||||
_regions.insert(new (alloc) Region(guest_addr, local_addr, ds, ds_size));
|
||||
}
|
||||
|
||||
void attach_to_vm(Genode::Vm_connection &vm_con,
|
||||
Genode::addr_t guest_start,
|
||||
Genode::addr_t size)
|
||||
{
|
||||
for (Region *r = _regions.first(); r; r = r->next())
|
||||
{
|
||||
if (!r->_ds_size || !size || size & 0xfff) continue;
|
||||
if (size > r->_ds_size) continue;
|
||||
if (guest_start < r->_guest_addr) continue;
|
||||
if (guest_start > r->_guest_addr + r->_ds_size - 1) continue;
|
||||
|
||||
Genode::addr_t ds_offset = guest_start - r->_guest_addr;
|
||||
vm_con.attach(r->_ds, guest_start, { .offset = ds_offset,
|
||||
.size = size,
|
||||
.executable = true,
|
||||
.writeable = true });
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void detach(Genode::addr_t const guest_addr, Genode::addr_t const size)
|
||||
{
|
||||
_vm_con.detach(guest_addr, size);
|
||||
}
|
||||
|
||||
Genode::addr_t alloc_io_memory(Genode::addr_t const size)
|
||||
{
|
||||
Genode::addr_t io_mem = _io_mem_alloc;
|
||||
_io_mem_alloc += size;
|
||||
return io_mem;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _GUEST_MEMORY_H_ */
|
@ -1,5 +0,0 @@
|
||||
REQUIRES = 32bit
|
||||
|
||||
LD_TEXT_ADDR = 0xbf800000
|
||||
|
||||
include $(REP_DIR)/src/app/seoul/target.inc
|
@ -1,5 +0,0 @@
|
||||
REQUIRES = 64bit
|
||||
|
||||
LD_TEXT_ADDR = 0x7fffbf800000
|
||||
|
||||
include $(REP_DIR)/src/app/seoul/target.inc
|
387
repos/ports/src/app/seoul/state.cc
Normal file
387
repos/ports/src/app/seoul/state.cc
Normal file
@ -0,0 +1,387 @@
|
||||
/*
|
||||
* \brief Transform state between Genode VM session interface and Seoul
|
||||
* \author Alexander Boettcher
|
||||
* \date 2018-08-27
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#include <base/log.h>
|
||||
|
||||
#include "state.h"
|
||||
|
||||
void Seoul::write_vm_state(CpuState &seoul, unsigned mtr, Genode::Vm_state &state)
|
||||
{
|
||||
state = Genode::Vm_state {}; /* reset */
|
||||
|
||||
if (mtr & MTD_GPR_ACDB) {
|
||||
state.ax.value(seoul.rax);
|
||||
state.cx.value(seoul.rcx);
|
||||
state.dx.value(seoul.rdx);
|
||||
state.bx.value(seoul.rbx);
|
||||
mtr &= ~MTD_GPR_ACDB;
|
||||
}
|
||||
|
||||
if (mtr & MTD_GPR_BSD) {
|
||||
state.di.value(seoul.rdix);
|
||||
state.si.value(seoul.rsix);
|
||||
state.bp.value(seoul.rbpx);
|
||||
mtr &= ~MTD_GPR_BSD;
|
||||
}
|
||||
|
||||
if (mtr & MTD_RIP_LEN) {
|
||||
state.ip.value(seoul.ripx);
|
||||
state.ip_len.value(seoul.inst_len);
|
||||
mtr &= ~MTD_RIP_LEN;
|
||||
}
|
||||
|
||||
if (mtr & MTD_RSP) {
|
||||
state.sp.value(seoul.rspx);
|
||||
mtr &= ~MTD_RSP;
|
||||
}
|
||||
|
||||
if (mtr & MTD_RFLAGS) {
|
||||
state.flags.value(seoul.rflx);
|
||||
mtr &= ~MTD_RFLAGS;
|
||||
}
|
||||
|
||||
if (mtr & MTD_DR) {
|
||||
state.dr7.value(seoul.dr7);
|
||||
mtr &= ~MTD_DR;
|
||||
}
|
||||
|
||||
if (mtr & MTD_CR) {
|
||||
state.cr0.value(seoul.cr0);
|
||||
state.cr2.value(seoul.cr2);
|
||||
state.cr3.value(seoul.cr3);
|
||||
state.cr4.value(seoul.cr4);
|
||||
mtr &= ~MTD_CR;
|
||||
}
|
||||
|
||||
typedef Genode::Vm_state::Segment Segment;
|
||||
typedef Genode::Vm_state::Range Range;
|
||||
|
||||
if (mtr & MTD_CS_SS) {
|
||||
state.cs.value(Segment{seoul.cs.sel, seoul.cs.ar, seoul.cs.limit, seoul.cs.base});
|
||||
state.ss.value(Segment{seoul.ss.sel, seoul.ss.ar, seoul.ss.limit, seoul.ss.base});
|
||||
mtr &= ~MTD_CS_SS;
|
||||
}
|
||||
|
||||
if (mtr & MTD_DS_ES) {
|
||||
state.es.value(Segment{seoul.es.sel, seoul.es.ar, seoul.es.limit, seoul.es.base});
|
||||
state.ds.value(Segment{seoul.ds.sel, seoul.ds.ar, seoul.ds.limit, seoul.ds.base});
|
||||
mtr &= ~MTD_DS_ES;
|
||||
}
|
||||
|
||||
if (mtr & MTD_FS_GS) {
|
||||
state.fs.value(Segment{seoul.fs.sel, seoul.fs.ar, seoul.fs.limit, seoul.fs.base});
|
||||
state.gs.value(Segment{seoul.gs.sel, seoul.gs.ar, seoul.gs.limit, seoul.gs.base});
|
||||
mtr &= ~MTD_FS_GS;
|
||||
}
|
||||
|
||||
if (mtr & MTD_TR) {
|
||||
state.tr.value(Segment{seoul.tr.sel, seoul.tr.ar, seoul.tr.limit, seoul.tr.base});
|
||||
mtr &= ~MTD_TR;
|
||||
}
|
||||
|
||||
if (mtr & MTD_LDTR) {
|
||||
state.ldtr.value(Segment{seoul.ld.sel, seoul.ld.ar, seoul.ld.limit, seoul.ld.base});
|
||||
mtr &= ~MTD_LDTR;
|
||||
}
|
||||
|
||||
if (mtr & MTD_GDTR) {
|
||||
state.gdtr.value(Range{seoul.gd.base, seoul.gd.limit});
|
||||
mtr &= ~MTD_GDTR;
|
||||
}
|
||||
|
||||
if (mtr & MTD_IDTR) {
|
||||
state.idtr.value(Range{seoul.id.base, seoul.id.limit});
|
||||
mtr &= ~MTD_IDTR;
|
||||
}
|
||||
|
||||
if (mtr & MTD_SYSENTER) {
|
||||
state.sysenter_cs.value(seoul.sysenter_cs);
|
||||
state.sysenter_sp.value(seoul.sysenter_esp);
|
||||
state.sysenter_ip.value(seoul.sysenter_eip);
|
||||
mtr &= ~MTD_SYSENTER;
|
||||
}
|
||||
|
||||
if (mtr & MTD_QUAL) {
|
||||
state.qual_primary.value(seoul.qual[0]);
|
||||
state.qual_secondary.value(seoul.qual[1]);
|
||||
/* not read by any kernel */
|
||||
mtr &= ~MTD_QUAL;
|
||||
}
|
||||
|
||||
if (mtr & MTD_CTRL) {
|
||||
state.ctrl_primary.value(seoul.ctrl[0]);
|
||||
state.ctrl_secondary.value(seoul.ctrl[1]);
|
||||
mtr &= ~MTD_CTRL;
|
||||
}
|
||||
|
||||
if (mtr & MTD_INJ) {
|
||||
state.inj_info.value(seoul.inj_info);
|
||||
state.inj_error.value(seoul.inj_error);
|
||||
mtr &= ~MTD_INJ;
|
||||
}
|
||||
|
||||
if (mtr & MTD_STATE) {
|
||||
state.intr_state.value(seoul.intr_state);
|
||||
state.actv_state.value(seoul.actv_state);
|
||||
mtr &= ~MTD_STATE;
|
||||
}
|
||||
|
||||
if (mtr & MTD_TSC) {
|
||||
state.tsc.value(seoul.tsc_value);
|
||||
state.tsc_offset.value(seoul.tsc_off);
|
||||
mtr &= ~MTD_TSC;
|
||||
}
|
||||
|
||||
if (mtr)
|
||||
Genode::error("state transfer incomplete ", Genode::Hex(mtr));
|
||||
}
|
||||
|
||||
unsigned Seoul::read_vm_state(Genode::Vm_state &state, CpuState &seoul)
|
||||
{
|
||||
unsigned mtr = 0;
|
||||
|
||||
if (state.ax.valid() || state.cx.valid() ||
|
||||
state.dx.valid() || state.bx.valid()) {
|
||||
|
||||
if (!state.ax.valid() || !state.cx.valid() ||
|
||||
!state.dx.valid() || !state.bx.valid())
|
||||
Genode::warning("missing state ", __LINE__);
|
||||
|
||||
mtr |= MTD_GPR_ACDB;
|
||||
|
||||
seoul.rax = state.ax.value();
|
||||
seoul.rcx = state.cx.value();
|
||||
seoul.rdx = state.dx.value();
|
||||
seoul.rbx = state.bx.value();
|
||||
}
|
||||
|
||||
if (state.bp.valid() || state.di.valid() || state.si.valid()) {
|
||||
|
||||
if (!state.bp.valid() || !state.di.valid() || !state.si.valid())
|
||||
Genode::warning("missing state ", __LINE__);
|
||||
|
||||
mtr |= MTD_GPR_BSD;
|
||||
seoul.rdix = state.di.value();
|
||||
seoul.rsix = state.si.value();
|
||||
seoul.rbpx = state.bp.value();
|
||||
}
|
||||
|
||||
if (state.flags.valid()) {
|
||||
mtr |= MTD_RFLAGS;
|
||||
seoul.rflx = state.flags.value();
|
||||
}
|
||||
|
||||
if (state.sp.valid()) {
|
||||
mtr |= MTD_RSP;
|
||||
seoul.rspx = state.sp.value();
|
||||
}
|
||||
|
||||
if (state.ip.valid() || state.ip_len.valid()) {
|
||||
if (!state.ip.valid() || !state.ip_len.valid())
|
||||
Genode::warning("missing state ", __LINE__);
|
||||
|
||||
mtr |= MTD_RIP_LEN;
|
||||
seoul.ripx = state.ip.value();
|
||||
seoul.inst_len = state.ip_len.value();
|
||||
}
|
||||
|
||||
if (state.dr7.valid()) {
|
||||
mtr |= MTD_DR;
|
||||
seoul.dr7 = state.dr7.value();
|
||||
}
|
||||
#if 0
|
||||
if (state.r8.valid() || state.r9.valid() ||
|
||||
state.r10.valid() || state.r11.valid() ||
|
||||
state.r12.valid() || state.r13.valid() ||
|
||||
state.r14.valid() || state.r15.valid()) {
|
||||
|
||||
Genode::warning("r8-r15 not supported");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (state.cr0.valid() || state.cr2.valid() ||
|
||||
state.cr3.valid() || state.cr4.valid()) {
|
||||
|
||||
mtr |= MTD_CR;
|
||||
|
||||
seoul.cr0 = state.cr0.value();
|
||||
seoul.cr2 = state.cr2.value();
|
||||
seoul.cr3 = state.cr3.value();
|
||||
seoul.cr4 = state.cr4.value();
|
||||
}
|
||||
|
||||
if (state.cs.valid() || state.ss.valid()) {
|
||||
if (!state.cs.valid() || !state.ss.valid())
|
||||
Genode::warning("missing state ", __LINE__);
|
||||
|
||||
mtr |= MTD_CS_SS;
|
||||
|
||||
seoul.cs.sel = state.cs.value().sel;
|
||||
seoul.cs.ar = state.cs.value().ar;
|
||||
seoul.cs.limit = state.cs.value().limit;
|
||||
seoul.cs.base = state.cs.value().base;
|
||||
|
||||
seoul.ss.sel = state.ss.value().sel;
|
||||
seoul.ss.ar = state.ss.value().ar;
|
||||
seoul.ss.limit = state.ss.value().limit;
|
||||
seoul.ss.base = state.ss.value().base;
|
||||
}
|
||||
|
||||
if (state.es.valid() || state.ds.valid()) {
|
||||
if (!state.es.valid() || !state.ds.valid())
|
||||
Genode::warning("missing state ", __LINE__);
|
||||
|
||||
mtr |= MTD_DS_ES;
|
||||
|
||||
seoul.es.sel = state.es.value().sel;
|
||||
seoul.es.ar = state.es.value().ar;
|
||||
seoul.es.limit = state.es.value().limit;
|
||||
seoul.es.base = state.es.value().base;
|
||||
|
||||
seoul.ds.sel = state.ds.value().sel;
|
||||
seoul.ds.ar = state.ds.value().ar;
|
||||
seoul.ds.limit = state.ds.value().limit;
|
||||
seoul.ds.base = state.ds.value().base;
|
||||
}
|
||||
|
||||
if (state.fs.valid() || state.gs.valid()) {
|
||||
if (!state.fs.valid() || !state.gs.valid())
|
||||
Genode::warning("missing state ", __LINE__);
|
||||
|
||||
mtr |= MTD_FS_GS;
|
||||
|
||||
seoul.fs.sel = state.fs.value().sel;
|
||||
seoul.fs.ar = state.fs.value().ar;
|
||||
seoul.fs.limit = state.fs.value().limit;
|
||||
seoul.fs.base = state.fs.value().base;
|
||||
|
||||
seoul.gs.sel = state.gs.value().sel;
|
||||
seoul.gs.ar = state.gs.value().ar;
|
||||
seoul.gs.limit = state.gs.value().limit;
|
||||
seoul.gs.base = state.gs.value().base;
|
||||
}
|
||||
|
||||
if (state.tr.valid()) {
|
||||
mtr |= MTD_TR;
|
||||
seoul.tr.sel = state.tr.value().sel;
|
||||
seoul.tr.ar = state.tr.value().ar;
|
||||
seoul.tr.limit = state.tr.value().limit;
|
||||
seoul.tr.base = state.tr.value().base;
|
||||
}
|
||||
|
||||
if (state.ldtr.valid()) {
|
||||
mtr |= MTD_LDTR;
|
||||
seoul.ld.sel = state.ldtr.value().sel;
|
||||
seoul.ld.ar = state.ldtr.value().ar;
|
||||
seoul.ld.limit = state.ldtr.value().limit;
|
||||
seoul.ld.base = state.ldtr.value().base;
|
||||
}
|
||||
|
||||
if (state.gdtr.valid()) {
|
||||
mtr |= MTD_GDTR;
|
||||
seoul.gd.limit = state.gdtr.value().limit;
|
||||
seoul.gd.base = state.gdtr.value().base;
|
||||
}
|
||||
|
||||
if (state.idtr.valid()) {
|
||||
mtr |= MTD_IDTR;
|
||||
seoul.id.limit = state.idtr.value().limit;
|
||||
seoul.id.base = state.idtr.value().base;
|
||||
}
|
||||
|
||||
if (state.sysenter_cs.valid() || state.sysenter_sp.valid() ||
|
||||
state.sysenter_ip.valid()) {
|
||||
|
||||
if (!state.sysenter_cs.valid() || !state.sysenter_sp.valid() ||
|
||||
!state.sysenter_ip.valid())
|
||||
Genode::warning("missing state ", __LINE__);
|
||||
|
||||
mtr |= MTD_SYSENTER;
|
||||
|
||||
seoul.sysenter_cs = state.sysenter_cs.value();
|
||||
seoul.sysenter_esp = state.sysenter_sp.value();
|
||||
seoul.sysenter_eip = state.sysenter_ip.value();
|
||||
}
|
||||
|
||||
if (state.ctrl_primary.valid() || state.ctrl_secondary.valid()) {
|
||||
if (!state.ctrl_primary.valid() || !state.ctrl_secondary.valid())
|
||||
Genode::warning("missing state ", __LINE__);
|
||||
|
||||
mtr |= MTD_CTRL;
|
||||
|
||||
seoul.ctrl[0] = state.ctrl_primary.value();
|
||||
seoul.ctrl[1] = state.ctrl_secondary.value();
|
||||
}
|
||||
|
||||
if (state.inj_info.valid() || state.inj_error.valid()) {
|
||||
if (!state.inj_info.valid() || !state.inj_error.valid())
|
||||
Genode::warning("missing state ", __LINE__);
|
||||
|
||||
mtr |= MTD_INJ;
|
||||
|
||||
seoul.inj_info = state.inj_info.value();
|
||||
seoul.inj_error = state.inj_error.value();
|
||||
}
|
||||
|
||||
if (state.intr_state.valid() || state.actv_state.valid()) {
|
||||
if (!state.intr_state.valid() || !state.actv_state.valid())
|
||||
Genode::warning("missing state ", __LINE__);
|
||||
|
||||
mtr |= MTD_STATE;
|
||||
|
||||
seoul.intr_state = state.intr_state.value();
|
||||
seoul.actv_state = state.actv_state.value();
|
||||
}
|
||||
|
||||
if (state.tsc.valid() || state.tsc_offset.valid()) {
|
||||
if (!state.tsc.valid() || !state.tsc_offset.valid())
|
||||
Genode::warning("missing state ", __LINE__);
|
||||
|
||||
mtr |= MTD_TSC;
|
||||
|
||||
seoul.tsc_value = state.tsc.value();
|
||||
seoul.tsc_off = state.tsc_offset.value();
|
||||
}
|
||||
|
||||
if (state.qual_primary.valid() || state.qual_secondary.valid()) {
|
||||
if (!state.qual_primary.valid() || !state.qual_secondary.valid())
|
||||
Genode::warning("missing state ", __LINE__);
|
||||
|
||||
mtr |= MTD_QUAL;
|
||||
|
||||
seoul.qual[0] = state.qual_primary.value();
|
||||
seoul.qual[1] = state.qual_secondary.value();
|
||||
}
|
||||
#if 0
|
||||
if (state.efer.valid()) {
|
||||
Genode::warning("efer not supported by Seoul");
|
||||
}
|
||||
|
||||
if (state.pdpte_0.valid() || state.pdpte_1.valid() ||
|
||||
state.pdpte_2.valid() || state.pdpte_3.valid()) {
|
||||
|
||||
Genode::warning("pdpte not supported by Seoul");
|
||||
}
|
||||
|
||||
if (state.star.valid() || state.lstar.valid() ||
|
||||
state.fmask.valid() || state.kernel_gs_base.valid()) {
|
||||
|
||||
Genode::warning("star, lstar, fmask, kernel_gs not supported by Seoul");
|
||||
}
|
||||
|
||||
if (state.tpr.valid() || state.tpr_threshold.valid()) {
|
||||
Genode::warning("tpr not supported by Seoul");
|
||||
}
|
||||
#endif
|
||||
return mtr;
|
||||
}
|
26
repos/ports/src/app/seoul/state.h
Normal file
26
repos/ports/src/app/seoul/state.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* \brief Transform state between Genode VM session interface and Seoul
|
||||
* \author Alexander Boettcher
|
||||
* \date 2018-08-27
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#ifndef _STATE_H_
|
||||
#define _STATE_H_
|
||||
|
||||
#include <cpu/vm_state.h>
|
||||
|
||||
#include <nul/vcpu.h>
|
||||
|
||||
namespace Seoul {
|
||||
void write_vm_state(CpuState &, unsigned mtr, Genode::Vm_state &);
|
||||
unsigned read_vm_state(Genode::Vm_state &, CpuState &);
|
||||
}
|
||||
|
||||
#endif /* _STATE_H_ */
|
@ -1,12 +1,11 @@
|
||||
TARGET = seoul
|
||||
REQUIRES = x86
|
||||
|
||||
SEOUL_CONTRIB_DIR = $(call select_from_ports,seoul)/src/app/seoul
|
||||
SEOUL_GENODE_DIR = $(SEOUL_CONTRIB_DIR)/genode
|
||||
|
||||
REQUIRES += nova
|
||||
|
||||
LIBS += base-nova blit seoul_libc_support
|
||||
SRC_CC = main.cc nova_user_env.cc device_model_registry.cc
|
||||
LIBS += base blit seoul_libc_support
|
||||
SRC_CC = component.cc user_env.cc device_model_registry.cc state.cc
|
||||
SRC_CC += console.cc keyboard.cc network.cc disk.cc
|
||||
SRC_BIN = mono.tff
|
||||
|
||||
@ -28,7 +27,7 @@ include $(call select_from_repositories,lib/mk/libc-common.inc)
|
||||
CC_CXX_WARN_STRICT = -Wextra -Weffc++ -Werror
|
||||
CC_WARN += -Wno-parentheses -Wall -Wno-unused
|
||||
CC_CXX_OPT += -march=core2
|
||||
CC_CXX_OPT += -mssse3
|
||||
CC_OPT_model/intel82576vf := -mssse3
|
||||
CC_OPT_PIC :=
|
||||
|
||||
vpath %.cc $(SEOUL_CONTRIB_DIR)
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* \brief Environment expected by the Vancouver code
|
||||
* \brief Environment expected by the Seoul code
|
||||
* \author Norman Feske
|
||||
* \date 2011-11-18
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2017 Genode Labs GmbH
|
||||
* Copyright (C) 2011-2019 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.
|
||||
@ -19,10 +19,7 @@
|
||||
#include <base/sleep.h>
|
||||
#include <base/thread.h>
|
||||
|
||||
/* VMM utils */
|
||||
#include <vmm/utcb_guard.h>
|
||||
|
||||
/* NOVA userland includes */
|
||||
/* Seoul userland includes */
|
||||
#include <service/logging.h>
|
||||
#include <service/memory.h>
|
||||
|
||||
@ -32,15 +29,8 @@ static
|
||||
void vprintf(const char *format, va_list &args)
|
||||
{
|
||||
using namespace Genode;
|
||||
typedef Vmm::Utcb_guard::Utcb_backup Utcb_backup;
|
||||
|
||||
static Lock lock;
|
||||
static Utcb_backup utcb_backup;
|
||||
static char buf[Log_session::MAX_STRING_LEN-4];
|
||||
|
||||
Lock::Guard guard(lock);
|
||||
utcb_backup = *(Utcb_backup *)Thread::myself()->utcb();
|
||||
|
||||
String_console sc(buf, sizeof(buf));
|
||||
sc.vprintf(format, args);
|
||||
|
||||
@ -48,8 +38,6 @@ void vprintf(const char *format, va_list &args)
|
||||
if (0 < n && buf[n-1] == '\n') n--;
|
||||
|
||||
log("VMM: ", Cstring(buf, n));
|
||||
|
||||
*(Utcb_backup *)Thread::myself()->utcb() = utcb_backup;
|
||||
}
|
||||
|
||||
void Logging::printf(const char *format, ...)
|
Loading…
x
Reference in New Issue
Block a user