diff --git a/repos/ports/include/vmm/guest_memory.h b/repos/ports/include/vmm/guest_memory.h
deleted file mode 100644
index 2a692a0473..0000000000
--- a/repos/ports/include/vmm/guest_memory.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * \brief Utilities for implementing VMMs on Genode/NOVA
- * \author Norman Feske
- * \date 2013-08-20
- *
- * The VMM and the guest share the same PD. However, the guest's view on the PD
- * is restricted to the guest-physical-to-VMM-local mappings installed by the
- * VMM for the VCPU's EC.
- *
- * The guest memory is shadowed at the lower portion of the VMM's address
- * space. If the guest (the VCPU EC) tries to access a page that has no mapping
- * in the VMM's PD, NOVA does not generate a page-fault (which would be
- * delivered to the pager of the VMM, i.e., core) but it produces a NPT
- * virtualization event handled locally by the VMM. The NPT event handler is
- * the '_svm_npt' function.
- */
-
-/*
- * Copyright (C) 2013-2017 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 _INCLUDE__VMM__GUEST_MEMORY_H_
-#define _INCLUDE__VMM__GUEST_MEMORY_H_
-
-/* Genode includes */
-#include
-#include
-#include
-#include
-
-/* VMM utilities includes */
-#include
-
-namespace Vmm {
- using namespace Genode;
-
- class Virtual_reservation;
- class Guest_memory;
-}
-
-
-/**
- * The 'Virtual_reservation' is a managed dataspace that occupies the lower
- * part of the address space, which contains the shadow of the VCPU's physical
- * memory.
- */
-struct Vmm::Virtual_reservation : private Rm_connection, Region_map_client
-{
- Genode::Env &_env;
-
- Virtual_reservation(Genode::Env &env, addr_t vm_size)
- :
- Rm_connection(env),
- Region_map_client(Rm_connection::create(vm_size)),
- _env(env)
- {
- try {
- /*
- * Attach reservation to the beginning of the local address
- * space. We leave out the very first page because core denies
- * the attachment of anything at the zero page.
- */
- env.rm().attach_at(Region_map_client::dataspace(), PAGE_SIZE, 0,
- PAGE_SIZE);
-
- } catch (Region_map::Region_conflict) {
- error("region conflict while attaching guest-physical memory");
- }
- }
-
- ~Virtual_reservation()
- {
- _env.rm().detach((void *)PAGE_SIZE);
- }
-};
-
-
-#endif /* _INCLUDE__VMM__GUEST_MEMORY_H_ */
diff --git a/repos/ports/include/vmm/types.h b/repos/ports/include/vmm/types.h
deleted file mode 100644
index 504b762514..0000000000
--- a/repos/ports/include/vmm/types.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * \brief Utilities for implementing VMMs on Genode/NOVA
- * \author Norman Feske
- * \date 2013-08-20
- */
-
-/*
- * Copyright (C) 2013-2017 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 _INCLUDE__VMM__TYPES_H_
-#define _INCLUDE__VMM__TYPES_H_
-
-namespace Vmm {
-
- enum {
- PAGE_SIZE_LOG2 = 12UL,
- PAGE_SIZE = PAGE_SIZE_LOG2 << 12
- };
-}
-
-#endif /* _INCLUDE__VMM__TYPES_H_ */
diff --git a/repos/ports/lib/import/import-seoul_libc_support.mk b/repos/ports/lib/import/import-seoul_libc_support.mk
deleted file mode 100644
index 6981d3ed54..0000000000
--- a/repos/ports/lib/import/import-seoul_libc_support.mk
+++ /dev/null
@@ -1 +0,0 @@
-include $(call select_from_repositories,lib/import/import-libc.mk)
diff --git a/repos/ports/lib/mk/seoul_libc_support.mk b/repos/ports/lib/mk/seoul_libc_support.mk
deleted file mode 100644
index 1143ca9e86..0000000000
--- a/repos/ports/lib/mk/seoul_libc_support.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-include $(call select_from_repositories,lib/mk/libc-common.inc)
-
-SRC_C = stdlib/strtoul.c
-SRC_C += $(addprefix string/,strchr.c strncpy.c strspn.c strcspn.c strstr.c strlen.c strnlen.c strcpy.c memcmp.c strcmp.c)
-SRC_C += sys/__error.c gen/errno.c locale/none.c locale/table.c
-
-vpath %.c $(LIBC_DIR)/lib/libc
-
-CC_CXX_WARN_STRICT =
diff --git a/repos/ports/ports/seoul.hash b/repos/ports/ports/seoul.hash
deleted file mode 100644
index 0562fba89b..0000000000
--- a/repos/ports/ports/seoul.hash
+++ /dev/null
@@ -1 +0,0 @@
-800924f3dc293d6c21d4e15fac0605ad4d7269b9
diff --git a/repos/ports/ports/seoul.port b/repos/ports/ports/seoul.port
deleted file mode 100644
index 0ca390a7ba..0000000000
--- a/repos/ports/ports/seoul.port
+++ /dev/null
@@ -1,38 +0,0 @@
-LICENSE := GPLv2
-VERSION := git
-DOWNLOADS := seoul.git
-
-URL(seoul) := https://github.com/alex-ab/seoul.git
-# branch genode_21_05
-REV(seoul) := 5676b9efa5be9f1c9f7a8297ab462d76933896af
-DIR(seoul) := src/app/seoul
-
-#
-# We need to execute some python scripts for preparing the i82576vf
-# device model.
-#
-PYTHON2 := $(notdir $(lastword $(shell which python2 python2.{4,5,6,7,8})))
-ifeq ($(PYTHON2),)
-default : missing_tool
-missing_tool:
- $(ECHO) "Error: Seoul needs Python 2 to be installed"
- @false;
-endif
-
-I82576VF_DIR = src/app/seoul/model/intel82576vf
-EXECUTOR_DIR = src/app/seoul/executor
-
-default : additional_steps
-additional_steps : $(DOWNLOADS)
- @echo "fix python version in code generator scripts ..." && \
- sed -i "s/env python2/env $(PYTHON2)/" $(I82576VF_DIR)/genreg.py $(EXECUTOR_DIR)/build_instructions.py && \
- sed -i "/Generated on/d" $(I82576VF_DIR)/genreg.py && \
- echo "call code generators ... takes a while ..." && \
- cd $(EXECUTOR_DIR) && \
- ./build_instructions.py > instructions.inc && \
- cd $(CURDIR)/$(I82576VF_DIR) && \
- ./genreg.py reg_pci.py ../../include/model/intel82576vfpci.inc && \
- cd $(CURDIR)/$(I82576VF_DIR) && \
- ./genreg.py reg_mmio.py ../../include/model/intel82576vfmmio.inc
-
-.PHONY: additional_steps
diff --git a/repos/ports/recipes/src/seoul/content.mk b/repos/ports/recipes/src/seoul/content.mk
deleted file mode 100644
index 8dbd864658..0000000000
--- a/repos/ports/recipes/src/seoul/content.mk
+++ /dev/null
@@ -1,65 +0,0 @@
-PORT_DIR_SEOUL := $(call port_dir,$(REP_DIR)/ports/seoul)
-
-SRC_DIR = src/app/seoul
-
-content: $(SRC_DIR) src/include
-
-$(SRC_DIR):
- mkdir -p $@
- cp -rH $(REP_DIR)/$@/* $@/
- cp -r $(PORT_DIR_SEOUL)/$@/* $@/
- cp $(PORT_DIR_SEOUL)/$@/LICENSE .
-
-BASE_SRC_INCLUDE := src/include/base/internal/crt0.h \
- src/include/base/internal/globals.h \
- src/include/base/internal/unmanaged_singleton.h
-
-src/include:
- mkdir -p $@/base/internal
- 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/types.h
-
-content: $(MIRROR_FROM_PORT_DIR)
-
-$(MIRROR_FROM_PORT_DIR):
- mkdir -p $(dir $@)
- cp -r $(GENODE_DIR)/repos/ports/$@ $(dir $@)
-
-
-MIRROR_FROM_LIBPORTS := lib/mk/libc-common.inc
-
-content: $(MIRROR_FROM_LIBPORTS)
-
-$(MIRROR_FROM_LIBPORTS):
- mkdir -p $(dir $@)
- cp -r $(GENODE_DIR)/repos/libports/$@ $(dir $@)
-
-content:
-
-MIRROR_FROM_BASE := lib/mk/cxx.mk
-
-content: $(MIRROR_FROM_BASE)
-
-$(MIRROR_FROM_BASE):
- mkdir -p $(dir $@)
- cp -r $(GENODE_DIR)/repos/base/$@ $(dir $@)
-
-PORT_DIR := $(call port_dir,$(GENODE_DIR)/repos/libports/ports/libc)
-
-include $(REP_DIR)/lib/mk/seoul_libc_support.mk
-
-MIRROR_FROM_LIBC := $(addprefix src/lib/libc/lib/libc/,$(SRC_C)) \
- src/lib/libc/lib/libc/locale/mblocal.h \
- src/lib/libc/lib/libc/locale/xlocale_private.h \
- src/lib/libc/lib/libc/locale/setlocale.h \
- src/lib/libc/lib/libc/include/libc_private.h \
-
-content: $(MIRROR_FROM_LIBC)
-
-$(MIRROR_FROM_LIBC):
- mkdir -p $(dir $@)
- cp -r $(PORT_DIR)/$@ $(dir $@)
diff --git a/repos/ports/recipes/src/seoul/hash b/repos/ports/recipes/src/seoul/hash
deleted file mode 100644
index e829b45445..0000000000
--- a/repos/ports/recipes/src/seoul/hash
+++ /dev/null
@@ -1 +0,0 @@
-2022-01-18 24cfd5b82ca7867a146b4b53bbdd4d89f194b0b2
diff --git a/repos/ports/recipes/src/seoul/used_apis b/repos/ports/recipes/src/seoul/used_apis
deleted file mode 100644
index 2e86176e37..0000000000
--- a/repos/ports/recipes/src/seoul/used_apis
+++ /dev/null
@@ -1,12 +0,0 @@
-base
-libc
-os
-blit
-nitpicker_gfx
-gui_session
-framebuffer_session
-input_session
-timer_session
-block_session
-nic_session
-rtc_session
diff --git a/repos/ports/run/seoul-auto.run b/repos/ports/run/seoul-auto.run
deleted file mode 100644
index ced00bf191..0000000000
--- a/repos/ports/run/seoul-auto.run
+++ /dev/null
@@ -1,86 +0,0 @@
-#
-# \brief Seoul on Genode - for automated testing
-# \author Alexander Boettcher
-# \date 2013-06-11
-#
-# This run script starts the Seoul VMM booting from a multiboot image.
-# It assumes that the module files are present at '/bin/'
-#
-
-assert_spec x86
-
-if { [get_cmd_switch --autopilot] && [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
-set use_model_ide 0
-
-set use_block_vdi 0
-set use_block_ram 0
-set use_block_sata 0
-
-set use_part_block 0
-
-set use_nic_session 1
-
-set use_framebuffer 1
-set use_fancy_stuff 0
-set use_top 0
-
-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 {
-
-
-
-}
-
-set guest_os_binaries { munich bzImage-3.1 seoul-auto.gz}
-set sha1_os_binaries { 7ecb4ba634a0ecfa6429418ea73490d6f65afead 6b2ef2c5bf16db3ebcbe33ce134e4e0a96944f82 bb6384fe58ab0c945b231f6cc107bcdff1bdacbe}
-
-#
-# Download demo kernel, image and
-# munich (part of Oslo framework http://os.inf.tu-dresden.de/~kauer/oslo)
-#
-set uri "http://genode.org/files/seoul"
-
-foreach binary $guest_os_binaries {
- if {![file exists bin/$binary]} {
- exec mkdir -p bin
- puts "Download file bin/$binary"
- exec >& /dev/null wget -c -O bin/$binary $uri/$binary
- }
-}
-
-source ${genode_dir}/repos/ports/run/seoul.inc
-
-append qemu_args " -cpu phenom "
-append qemu_args " -nographic "
-append_qemu_nic_args
-
-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
-}
diff --git a/repos/ports/run/seoul-disc.run b/repos/ports/run/seoul-disc.run
deleted file mode 100644
index dfaa0b179d..0000000000
--- a/repos/ports/run/seoul-disc.run
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# \brief Seoul on Genode - test to boot from a raw disk
-# \author Alexander Boettcher
-# \date 2013-06-11
-#
-# This run script starts the Seoul VMM booting from a disc image.
-# It assumes that the module files are present at '/bin/'
-#
-
-set use_multiboot 0
-set use_genode_iso 0
-set use_model_ahci 1
-set use_model_ide 0
-
-set use_block_vdi 0
-set use_block_ram 1
-set use_block_sata 0
-
-set use_part_block 0
-
-set use_nic_session 1
-
-set use_framebuffer 1
-set use_fancy_stuff 0
-set use_top 0
-
-set memory_vmm_vm "512M"
-
-set vcpus_to_be_used 1
-
-if {[have_include power_on/qemu]} {
-
- if {![file exists bin/seoul-disc.raw]} {
- puts "Please provide a disk image file to bin/seoul-disc.raw"
- exit 1
- }
-
- append qemu_args " -m 1536 "
- append qemu_args " -cpu phenom"
- append_if $use_block_sata qemu_args " -drive id=disk,file=bin/seoul-disc.raw,format=raw,if=none -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 -boot d"
-}
-
-source ${genode_dir}/repos/ports/run/seoul.inc
-
-run_genode_until forever
diff --git a/repos/ports/run/seoul-fancy.run b/repos/ports/run/seoul-fancy.run
deleted file mode 100644
index 87dbdc0b5d..0000000000
--- a/repos/ports/run/seoul-fancy.run
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# \brief Example for using Seoul on Genode
-# \author Norman Feske
-# \author Markus Partheymueller
-# \author Alexander Boettcher
-# \date 2011-11-21
-#
-# This run script starts the Seoul VMM booting the multiboot modules
-# listed in the 'multiboot' config node. It assumes that the module files
-# are present at '/bin/' (see the 'boot_modules' variable).
-#
-
-set use_multiboot 1
-set use_genode_iso 0
-set use_model_ahci 0
-set use_model_ide 0
-
-set use_block_vdi 0
-set use_block_ram 0
-set use_block_sata 0
-
-set use_part_block 0
-
-set use_nic_session 1
-
-set use_framebuffer 1
-set use_fancy_stuff 1
-set use_top 0
-
-set memory_init "288M"
-set memory_vmm_vm "128M"
-
-set vcpus_to_be_used 1
-
-set multiboot_files {
-
-
-
-}
-
-set guest_os_binaries { munich bzImage-3.1 tc-browser.gz }
-set sha1_os_binaries { 7ecb4ba634a0ecfa6429418ea73490d6f65afead 6b2ef2c5bf16db3ebcbe33ce134e4e0a96944f82 51aa53eb494b71d65f7fe3eb05e52af4616878bd}
-
-#
-# Download demo kernel, image and
-# munich (part of Oslo framework http://os.inf.tu-dresden.de/~kauer/oslo)
-#
-set uri "http://genode.org/files/seoul"
-
-foreach binary $guest_os_binaries {
- if {![file exists bin/$binary]} {
- puts "Download file bin/$binary"
- exec mkdir -p bin
- exec >& /dev/null wget -c -O bin/$binary $uri/$binary
- }
-}
-
-source ${genode_dir}/repos/ports/run/seoul.inc
-
-append qemu_args " -m 1024 "
-append qemu_args " -cpu phenom "
-append_qemu_nic_args
-
-run_genode_until forever
diff --git a/repos/ports/run/seoul-genode.run b/repos/ports/run/seoul-genode.run
deleted file mode 100644
index 2f66ba2925..0000000000
--- a/repos/ports/run/seoul-genode.run
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# \brief Turn a Genode setup(run script) into a VM to be bootable in Seoul
-# \author Alexander Boettcher
-# \date 2014-09-21
-#
-# This run script starts the Seoul VMM booting from a multiboot Genode setup
-# created by another Genode run script. The referenced run script can be
-# adapted by tuning the variables run_script and build_dir below accordingly.
-#
-
-set use_multiboot 1
-set use_genode_iso 1
-set use_model_ahci 1
-set use_model_ide 0
-
-set use_block_vdi 0
-set use_block_ram 0
-set use_block_sata 0
-
-set use_part_block 0
-
-set use_nic_session 1
-
-set use_framebuffer 1
-set use_fancy_stuff 0
-set use_top 1
-
-set memory_vmm_vm "128M"
-
-set vcpus_to_be_used 1
-
-# Put the multiboot data structure out of the way of Nova's bss.
-set use_multiboot_modaddr 0x2800000
-
-# Use a Genode run script of a 32bit platform and turn it into a bootable
-# setup for Seoul - adjust build_dir and run_script variable accordingly
-set run_script "log"
-set build_dir "."
-set run_script_path "$build_dir/var/run/$run_script"
-set genode_iso "$build_dir/var/run/$run_script.iso"
-
-if {[catch {exec cp $genode_iso bin/genode.iso}]} {
- puts "Run scenario '$run_script' is not present. Please run it before\
- invoking this run script."
- exit 1
-}
-
-set files_vm [exec isoinfo -i $genode_iso -x "/boot/grub/grub.cfg;1"]
-
-set vm [split $files_vm "\n"]
-set guest_os_binaries {}
-foreach line $vm {
- if {[regexp "module\.*" $line] || [regexp "kernel\.*" $line]} {
- set label_file [lindex $line 1]
- set binary_cmdline [lrange $line 2 end]
- regsub -all "/fiasco/" $label_file "" binary_file
- regsub -all "/boot/" $binary_file "" binary_file
- regsub -all "/genode/" $binary_file "" binary_file
-
- # skip bender to speed up booting
- if {$binary_file == "bender"} {
- continue
- }
-
- set file_type [exec file $run_script_path$label_file]
- if {[regexp "gzip" $file_type]} {
- exec gunzip --keep $run_script_path$label_file -c >file.tmp
- set file_type [exec file file.tmp]
- exec rm file.tmp
- }
-
- if {[regexp "ELF 64-bit" $file_type]} {
- puts "Seoul supports only 32bit guests - choose a 32bit Genode platform"
- puts "Exit reason: $file_type"
- exit 2
- }
- if {[regexp "No such" $file_type]} {
- puts "$file_type"
- exit 3
- }
-
- if {$binary_cmdline eq ""} {
- append multiboot_files "\n"
- } else {
- append multiboot_files "\n"
- }
- }
-}
-# Seoul VM setup done
-
-source ${genode_dir}/repos/ports/run/seoul.inc
-
-append qemu_args " -m 1024 "
-append qemu_args " -cpu phenom "
-
-run_genode_until forever
diff --git a/repos/ports/run/seoul-kernelbuild.run b/repos/ports/run/seoul-kernelbuild.run
deleted file mode 100644
index 31a6da07c7..0000000000
--- a/repos/ports/run/seoul-kernelbuild.run
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# \brief Seoul on Genode - build Linux kernel inside VM
-# \author Alexander Boettcher
-# \date 2013-06-11
-#
-# This run script starts the Seoul VMM booting from a multiboot image.
-# It assumes that the module files are present at '/bin/'
-#
-
-assert_spec x86
-
-if {[have_include power_on/qemu]} {
- puts "\nAuto test running on Qemu is not recommended.\n"
- exit
-}
-
-set use_multiboot 1
-set use_genode_iso 0
-set use_model_ahci 0
-set use_model_ide 0
-
-set use_block_vdi 0
-set use_block_ram 0
-set use_block_sata 0
-
-set use_part_block 0
-
-set use_nic_session 0
-
-set use_framebuffer 1
-set use_fancy_stuff 0
-set use_top 0
-
-set memory_vmm_vm "950M"
-
-# adjust also '-j option' accordingly - see benchmark_cmd
-set vcpus_to_be_used 1
-
-set multiboot_files {
-
-
-
-}
-
-set guest_os_binaries { munich bzImage-3.1 kernelbuild-e2fs.bz2 }
-set sha1_os_binaries { 7ecb4ba634a0ecfa6429418ea73490d6f65afead 6b2ef2c5bf16db3ebcbe33ce134e4e0a96944f82 978b2a297c7ff8e53191321d300e70baa1036519 }
-
-#
-# Download demo kernel, image and
-# munich (part of Oslo framework http://os.inf.tu-dresden.de/~kauer/oslo)
-#
-set guest_uri { "http://genode.org/files/seoul" "http://genode.org/files/seoul" "http://os.inf.tu-dresden.de/~nils/imgs" }
-
-set binary_counter 0
-foreach binary $guest_os_binaries {
- if {![file exists bin/$binary]} {
- set uri [lindex $guest_uri $binary_counter]
- exec mkdir -p bin
- puts "Download file bin/$binary from $uri"
- exec >& /dev/null wget -c -O bin/$binary $uri/$binary
- }
- incr binary_counter 1
-}
-
-source ${genode_dir}/repos/ports/run/seoul.inc
-
-append qemu_args " -m 1536 "
-append qemu_args " -cpu phenom "
-append qemu_args " -nographic "
-
-run_genode_until {\[init -\> seoul\] VM is starting with } 400
-set serial_id [output_spawn_id]
-
-set time_start [ clock seconds ]
-run_genode_until {\[init -\> seoul\] VMM: # ! PERF: kbuild [ 0-9]+ s ok} 2000 $serial_id
-set time_end [ clock seconds ]
-
-puts "\n! PERF: runtime [expr $time_end - $time_start ] seconds ok"
-
-puts "Test succeeded"
diff --git a/repos/ports/run/seoul-net.run b/repos/ports/run/seoul-net.run
deleted file mode 100644
index 347d07ccf3..0000000000
--- a/repos/ports/run/seoul-net.run
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# \brief Seoul on Genode - for testing network
-# \author Alexander Boettcher
-# \date 2013-06-11
-#
-# This run script starts the Seoul VMM booting from a multiboot image.
-# It assumes that the module files are present at '/bin/'
-#
-
-set use_multiboot 1
-set use_genode_iso 0
-set use_model_ahci 0
-set use_model_ide 0
-
-set use_block_vdi 0
-set use_block_ram 0
-set use_block_sata 0
-
-set use_part_block 0
-
-set use_nic_session 1
-
-set use_framebuffer 1
-set use_fancy_stuff 0
-set use_top 0
-
-set memory_vmm_vm "128M"
-
-set vcpus_to_be_used 1
-
-set multiboot_files {
-
-
-
-}
-
-set guest_os_binaries { munich bzImage-3.1 tc-net.gz}
-set sha1_os_binaries { 7ecb4ba634a0ecfa6429418ea73490d6f65afead 6b2ef2c5bf16db3ebcbe33ce134e4e0a96944f82 201deb4bd18fb07f3d0b5495b948ba622ff98e4b}
-
-#
-# Download demo kernel, image and
-# munich (part of Oslo framework http://os.inf.tu-dresden.de/~kauer/oslo)
-#
-set uri "http://genode.org/files/seoul"
-
-foreach binary $guest_os_binaries {
- if {![file exists bin/$binary]} {
- exec mkdir -p bin
- puts "Download file bin/$binary"
- exec >& /dev/null wget -c -O bin/$binary $uri/$binary
- }
-}
-
-source ${genode_dir}/repos/ports/run/seoul.inc
-
-append qemu_args " -cpu phenom "
-append_qemu_nic_args
-
-run_genode_until forever
diff --git a/repos/ports/run/seoul.inc b/repos/ports/run/seoul.inc
deleted file mode 100644
index a155a9765a..0000000000
--- a/repos/ports/run/seoul.inc
+++ /dev/null
@@ -1,654 +0,0 @@
-#
-# \brief Using Seoul on Genode
-# \author Norman Feske
-# \author Markus Partheymueller
-# \author Alexander Boettcher
-# \date 2011-11-21
-
-set use_fs_rump $use_block_vdi
-set use_drv_ahci [expr $use_block_vdi || $use_block_sata]
-set use_vfs_block [expr $use_block_ram || $use_genode_iso]
-
-create_boot_directory
-
-import_from_depot [depot_user]/src/[base_src] \
- [depot_user]/src/event_filter \
- [depot_user]/src/init \
- [depot_user]/src/nitpicker \
- [depot_user]/src/usb_host_drv \
- [depot_user]/src/usb_hid_drv \
- [depot_user]/src/vfs_import \
- [depot_user]/src/ps2_drv \
- [depot_user]/raw/drivers_interactive-pc
-
-if {$use_fs_rump} {
- import_from_depot [depot_user]/src/vfs \
- [depot_user]/src/rump
-}
-
-if {$use_part_block} {
- import_from_depot [depot_user]/src/part_block
-}
-
-#
-# Build
-#
-
-assert_spec x86
-
-set map_small "no"
-set vmm_vcpu_same_cpu "no"
-
-if {[have_spec sel4]} {
- set map_small "yes"
- set vmm_vcpu_same_cpu "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
- }
-}
-
-if {[have_spec foc]} {
- # The performance is considerable bad when
- # vmm and vcpu is not on same physical CPU
- set vmm_vcpu_same_cpu "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
-proc platform_drv_priority {} { return { priority="-1"} }
-
-set build_components {
- drivers/rtc
- app/seoul
-}
-
-if {$use_fancy_stuff} { set use_framebuffer 1 }
-
-lappend_if $use_block_vdi build_components server/vdi_block
-lappend_if $use_vfs_block build_components server/vfs_block
-lappend_if $use_drv_ahci build_components drivers/ahci
-lappend_if $use_nic_session build_components drivers/nic
-lappend_if $use_nic_session build_components server/nic_router
-lappend_if $use_framebuffer build_components drivers/framebuffer
-lappend_if $use_fancy_stuff build_components app/status_bar
-lappend_if $use_fancy_stuff build_components app/launchpad
-lappend_if $use_fancy_stuff build_components server/report_rom
-lappend_if $use_genode_iso build_components server/iso9660
-lappend_if $use_top build_components app/top
-
-append_platform_drv_build_components
-
-build $build_components
-
-# write Seoul config file
-set vm_cfg_fd [open "bin/vm_seoul.cfg" w]
-puts $vm_cfg_fd ""
-puts $vm_cfg_fd {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
-
-if {!$use_multiboot} {
- puts $vm_cfg_fd {
-
- }
-}
-
- puts $vm_cfg_fd {
-
-
-
- }
-
-if {$use_multiboot} {
- if {[info exists use_multiboot_modaddr]} {
- puts $vm_cfg_fd " "
- } else {
- puts $vm_cfg_fd { }
- }
-}
-
-puts $vm_cfg_fd {
-
-
-
- }
-
-for {set i 0} {$i < $vcpus_to_be_used} {incr i 1} {
- puts $vm_cfg_fd {
- }
-}
-
-if {!$use_multiboot} {
-
- if {$use_model_ahci} {
- puts $vm_cfg_fd {
-
-
- }
- }
- if {$use_model_ide} {
- puts $vm_cfg_fd {
-
- }
- }
-}
-
-if {$use_nic_session} {
- puts $vm_cfg_fd {
-
-
- }
-}
-
-puts $vm_cfg_fd {
-
- }
-
-if {$use_multiboot} {
- puts $vm_cfg_fd $multiboot_files
-}
-
-puts $vm_cfg_fd {
-
-}
-close $vm_cfg_fd
-
-#
-# Generate Genode config
-#
-
-set config {
-
-
-
-
-
-
-
-
-
-
- }
-
-append_if $use_top config {
- }
-
-append config {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
-
-
-append_if $use_drv_ahci config {
-
-
-
- }
-
-append_if [expr $use_block_sata && !$use_part_block] config {
- }
-
-append_if [expr $use_block_vdi && !$use_part_block] config {
- }
-
-append_if [expr $use_block_vdi && $use_part_block] config {
- }
-
-append_if [expr $use_block_sata && $use_part_block] config {
- }
-
-append_if $use_drv_ahci config {
-
- }
-
-append_if $use_part_block config {
-
-
-
-
-
-
-
-
-
-
- }
-
-append_if $use_block_ram config {
-
-
-
-
-
-
-
-
-
-
-
-
- }
-
-append_if $use_fs_rump config {
-
-
-
-
-
-
-
-
-
-
-
- }
-
-append_if [expr $use_fs_rump && $use_part_block] config {
- }
-append_if [expr $use_fs_rump && !$use_part_block] config {
- }
-
-append_if $use_fs_rump config {
-
-
- }
-
-append_if $use_block_vdi config {
-
-
-
-
-
-
-
-
-
-
-
- }
-
-append_if $use_genode_iso config {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
-
-append_platform_drv_config
-
-append_if $use_nic_session config {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-}
-
-append_if $use_framebuffer config {
-
-
-
-
-
-
-
-
- }
-append_if [expr $use_framebuffer && [have_include "power_on/qemu"]] config {
- }
-append_if [expr $use_framebuffer && ![have_include "power_on/qemu"]] config {
- }
-append_if $use_framebuffer config {
- }
-
-if {!$use_fancy_stuff} {
-append config {
-
- }
-append config "
- "
-append config {
-
-
-
- }
-append_if [expr $use_nic_session] config {
- }
-append_if $use_genode_iso config {
-
-
-
- }
-append_if $use_block_vdi config {
- }
-append_if [expr $use_block_sata && $use_part_block] config {
- }
-append config {
-
-
-
- }
-}
-
-append config {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
-
-append_if $use_top config {
-
-
-
- }
-
-append_if $use_fancy_stuff config {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
-
-append config {
-}
-
-#
-# Generate Launchpad config file
-#
-if {$use_fancy_stuff} {
- set launchpad_cfg_fd [open "bin/launchpad-config" w]
-
- puts $launchpad_cfg_fd "
- "
-
- puts $launchpad_cfg_fd {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- puts $launchpad_cfg_fd {}
- close $launchpad_cfg_fd
-}
-
-install_config $config
-
-#
-# Boot modules
-#
-
-# generic modules
-set boot_modules {
- rtc_drv
- seoul
- vm_seoul.cfg
-}
-
-lappend_if $use_block_vdi boot_modules vdi_block
-lappend_if $use_vfs_block boot_modules vfs_block
-lappend_if $use_vfs_block boot_modules vfs.lib.so
-lappend_if $use_drv_ahci boot_modules ahci_drv
-lappend_if $use_nic_session boot_modules ipxe_nic_drv
-lappend_if $use_nic_session boot_modules nic_router
-lappend_if $use_framebuffer boot_modules vesa_fb_drv
-
-lappend_if $use_fancy_stuff boot_modules status_bar
-lappend_if $use_fancy_stuff boot_modules launchpad
-lappend_if $use_fancy_stuff boot_modules launchpad-config
-lappend_if $use_fancy_stuff boot_modules report_rom
-
-lappend_if $use_genode_iso boot_modules iso9660
-lappend_if $use_genode_iso boot_modules genode.iso
-
-lappend_if $use_block_ram boot_modules seoul-disc.raw
-
-lappend_if $use_top boot_modules top
-
-#
-# Add OS binaries of guest
-#
-
-if {$use_multiboot} {
- set guest_os_binary_missing 0
- set binary_counter 0
- foreach binary $guest_os_binaries {
- if {![file exists bin/$binary]} {
- puts stderr "Error: guest OS binary \"bin/$binary\" does not exist"
- set guest_os_binary_missing 1
- }
-
- if {[info exists sha1_os_binaries]} {
- set sha1 [exec sha1sum bin/$binary]
- set sha1 [regexp -inline {[0-9a-h]+} $sha1]
- if {[string compare $sha1 [lindex $sha1_os_binaries $binary_counter]]} {
- puts "SHA1 sum of binary does not match with expected one - abort"
- puts "$binary $sha1 != [lindex $sha1_os_binaries $binary_counter]"
- set guest_os_binary_missing 1
- }
- }
- incr binary_counter 1
- }
-
- if {$guest_os_binary_missing} { exit 1 }
-
- append boot_modules $guest_os_binaries
-}
-
-append_platform_drv_boot_modules
-
-build_boot_image $boot_modules
-
-# A copy of the config is placed in the run folder.
-exec rm -f bin/vm_seoul.cfg
diff --git a/repos/ports/run/vm_stress_seoul-debian32.run b/repos/ports/run/vm_stress_seoul-debian32.run
deleted file mode 100644
index 3d6a73f57d..0000000000
--- a/repos/ports/run/vm_stress_seoul-debian32.run
+++ /dev/null
@@ -1,137 +0,0 @@
-#
-# \brief Seoul on Genode - boot from a vdi or raw
-# \author Alexander Boettcher
-# \date 2020-03-12
-#
-
-assert_spec x86
-
-if { [get_cmd_switch --autopilot] && [have_spec x86_32] } {
- puts "Run script does not support autopilot mode on 32 bit"
- exit 0
-}
-
-if { [get_cmd_switch --autopilot] && [have_include power_on/qemu] } {
- puts "\n Run script is not supported on this platform. \n";
- exit 0
-}
-
-#if {[have_spec foc] || [have_spec sel4] || [have_spec nova]} {
-if {[have_spec nova]} {
-} else {
- puts "\n Run script is not supported on this platform. \n";
- exit 0
-}
-
-set use_multiboot 0
-set use_genode_iso 0
-set use_model_ahci 1
-set use_model_ide 0
-
-set use_block_vdi 0
-set use_block_ram 0
-set use_block_sata 1
-
-set use_part_block [expr ![have_include power_on/qemu]]
-
-set use_nic_session 1
-
-set use_usb 0
-
-set use_framebuffer 1
-set use_fancy_stuff 0
-set use_top 0
-
-set memory_vmm_vm "1280M"
-
-set vcpus_to_be_used 2
-
-if {[have_include power_on/qemu]} {
-
- if {![file exists bin/seoul-disc.raw]} {
- if {![file exists bin/seoul_stress32.vdi]} {
- puts "Please provide a disk image file to bin/seoul_stress32.vdi"
- exit 1
- }
-
-# if {![file exists bin/seoul_stress32.raw]} {
-# puts "Please provide a disk image file to bin/seoul_stress32.raw"
-# exit 1
-# }
-
- set mke2fs [installed_command mke2fs]
- set dd [installed_command dd]
-
-# catch { exec $dd if=/dev/zero of=bin/seoul-disc.raw bs=1M count=12000 }
- catch { exec $dd if=/dev/zero of=bin/seoul-disc.raw bs=1M count=6000 }
- catch { exec $mke2fs -F bin/seoul-disc.raw }
-
- exec [installed_command e2cp] bin/seoul_stress32.vdi bin/seoul-disc.raw:seoul_stress32.vdi
-# exec [installed_command e2cp] bin/seoul_stress32.raw bin/seoul-disc.raw:seoul_stress32.raw
- }
-
- append qemu_args " -m 2536 "
- append qemu_args " -cpu phenom"
-
- append qemu_args " -drive id=disk,file=bin/seoul-disc.raw,format=raw,if=none"
- append qemu_args " -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0"
-
- run_genode_until forever
- exit
-}
-
-set match_guest_log "\[init -\> seoul\].*VMM: #"
-set match_guest_down "\[init -\> seoul\].*VMM: STANDBY IMMEDIATE"
-set match_boot_string "--- Seoul VMM starting ---"
-set vmm_name "seoul"
-
-set vcpus_to_be_used 1
-set use_vcpus $vcpus_to_be_used
-lappend results_expected 1 2 20 75
-lappend boottime_expected 51
-source ${genode_dir}/repos/ports/run/seoul.inc
-source ${genode_dir}/repos/ports/run/vmm_vm_stress.inc
-run_genode_until $match_guest_down 20 [output_spawn_id]
-kill_spawned [output_spawn_id]
-
-set vcpus_to_be_used 2
-set use_vcpus $vcpus_to_be_used
-lappend results_expected 2 2 21 46
-lappend boottime_expected 51
-source ${genode_dir}/repos/ports/run/seoul.inc
-source ${genode_dir}/repos/ports/run/vmm_vm_stress.inc
-run_genode_until $match_guest_down 20 [output_spawn_id]
-kill_spawned [output_spawn_id]
-
-set vcpus_to_be_used 3
-set use_vcpus $vcpus_to_be_used
-lappend results_expected 3 2 21 37
-lappend boottime_expected 52
-source ${genode_dir}/repos/ports/run/seoul.inc
-source ${genode_dir}/repos/ports/run/vmm_vm_stress.inc
-run_genode_until $match_guest_down 20 [output_spawn_id]
-kill_spawned [output_spawn_id]
-
-set vcpus_to_be_used 4
-set use_vcpus $vcpus_to_be_used
-lappend results_expected 4 2 23 33
-lappend boottime_expected 53
-source ${genode_dir}/repos/ports/run/seoul.inc
-source ${genode_dir}/repos/ports/run/vmm_vm_stress.inc
-run_genode_until $match_guest_down 20 [output_spawn_id]
-kill_spawned [output_spawn_id]
-
-#
-# Dump aggregated output of the several runs above
-#
-grep_output "$match_guest_log.*cpus="
-
-puts $output
-
-set merge_host_output [split $output_host "\n"]
-set merge_host_extra [split $output_host_extra "\n"]
-for { set i 0 } { $i < [llength $merge_host_output] } { incr i} {
- puts "[lindex $merge_host_output $i] [lindex $merge_host_extra $i]"
-}
-
-evaluate_stress
diff --git a/repos/ports/src/app/seoul/README b/repos/ports/src/app/seoul/README
deleted file mode 100644
index aae3e8b8bf..0000000000
--- a/repos/ports/src/app/seoul/README
+++ /dev/null
@@ -1,32 +0,0 @@
-Seoul (formerly Vancouver) is a virtual machine monitor originally developed
-for the use with the NOVA hypervisor. Nowadays it is also available for seL4,
-for Fiasco.OC and for NOVA on Genode. Seoul virtualizes 32bit x86 PC hardware
-including various peripherals. The combination of NOVA and Vancouver (later
-Seoul) is described in the following paper by Udo Steinberg and Bernhard Kauer:
-
-[http://os.inf.tu-dresden.de/papers_ps/steinberg_eurosys2010.pdf - NOVA: A Microhypervisor-Based Secure Virtualization Architecture]
-
-The NOVA project website is [http://hypervisor.org]
-The latest Seoul home is [https://github.com/TUD-OS/seoul]
-The Seoul version as used by Genode is [https://github.com/alex-ab/seoul], branch
-genode_.
-
-Usage
------
-
-
- ...
-
-
-* The width/height specify the maximum area announced to the guest for the
- framebuffer. The values are read once during boot of the VMM. The
- values shown above are the default values.
-* The vmm_memory value specify the amount of memory reserved for the Seoul VMM
- (so it is not available to the VM). The rest of the memory as specified in
- the Genode config is assigned to the VM.
-* map_small specifies whether just 4k pages should be used. Default is shown.
-* rdtsc_exit specifies whether the VM should exit on each rdtsc instruction.
- Default is shown.
-* vmm_vcpu_same_cpu specifies whether the main entrypoint should run on the
- same CPU as the first virtual CPU. Default is shown.
diff --git a/repos/ports/src/app/seoul/boot_module_provider.h b/repos/ports/src/app/seoul/boot_module_provider.h
deleted file mode 100644
index c737f6f444..0000000000
--- a/repos/ports/src/app/seoul/boot_module_provider.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * \brief Back end used for obtaining multi-boot modules
- * \author Norman Feske
- * \author Markus Partheymueller
- * \date 2011-11-20
- */
-
-/*
- * Copyright (C) 2011-2017 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.
- *
- * Modifications by Intel Corporation are contributed under the terms and
- * conditions of the GNU General Public License version 2.
- */
-
-#ifndef _BOOT_MODULE_PROVIDER_H_
-#define _BOOT_MODULE_PROVIDER_H_
-
-/* Genode includes */
-#include
-#include
-#include
-#include
-#include
-
-
-class Boot_module_provider
-{
- private:
-
- Genode::Xml_node _multiboot_node;
-
- enum { MODULE_NAME_MAX_LEN = 48 };
-
- typedef Genode::String Name;
-
- public:
-
- /**
- * Exception class
- */
- class Destination_buffer_too_small { };
- class Module_loading_failed { };
-
- /**
- * Constructor
- *
- * \param multiboot_node XML node containing the list of boot modules
- * as sub nodes
- */
- Boot_module_provider(Genode::Xml_node multiboot_node)
- :
- _multiboot_node(multiboot_node)
- { }
-
-
- /************************************
- ** Boot_module_provider interface **
- ************************************/
-
- /**
- * Copy module data to specified buffer
- *
- * \return module size in bytes, or 0 if module does not exist
- * \throw Destination_buffer_too_small
- */
- Genode::size_t data(Genode::Env &env, int module_index,
- void *dst, Genode::size_t dst_len) const
- {
- using namespace Genode;
-
- try {
- Xml_node mod_node = _multiboot_node.sub_node(module_index);
-
- if (mod_node.has_type("rom")) {
-
- /*
- * Determine ROM file name, which is specified as 'label'
- * attribute of the 'rom' node. If no 'label' argument is
- * provided, use the 'name' attribute as file name.
- */
- Name const label = mod_node.has_attribute("label")
- ? mod_node.attribute_value("label", Name())
- : mod_node.attribute_value("name", Name());
- /*
- * Open ROM session
- */
- Rom_connection rom(env, label.string());
- Dataspace_capability ds = rom.dataspace();
- Genode::size_t const src_len = Dataspace_client(ds).size();
-
- if (src_len > dst_len) {
- warning(__func__, ": src_len=", src_len, " dst_len=", dst_len);
- throw Destination_buffer_too_small();
- }
-
- void * const src = env.rm().attach(ds);
-
- /*
- * Copy content to destination buffer
- */
- Genode::memcpy(dst, src, src_len);
-
- /*
- * Detach ROM dataspace from local address space. The ROM
- * session will be closed automatically when we leave the
- * current scope and the 'rom' object gets destructed.
- */
- env.rm().detach(src);
-
- return src_len;
-
- } else if (mod_node.has_type("inline")) {
-
- /*
- * Copy inline content directly to destination buffer
- */
- mod_node.with_raw_content([&] (char const *ptr, size_t size) {
- Genode::memcpy(dst, ptr, size); });
-
- return mod_node.content_size();
- }
-
- warning("XML node ", module_index, " in multiboot node has unexpected type");
-
- throw Module_loading_failed();
- }
- catch (Xml_node::Nonexistent_sub_node) { }
- catch (Xml_node::Nonexistent_attribute) { }
- catch (Destination_buffer_too_small) {
- error("Boot_module_provider: destination buffer too small"); }
- catch (Region_map::Region_conflict) {
- error("Boot_module_provider: Region_map::Region_conflict");
- throw Module_loading_failed(); }
- catch (Region_map::Invalid_dataspace) {
- error("Boot_module_provider: Region_map::Invalid_dataspace");
- throw Module_loading_failed(); }
- catch (Rom_connection::Rom_connection_failed) {
- error("Boot_module_provider: Rom_connection_failed"); }
- catch (...) {
- error("Boot_module_provider: Spurious exception");
- throw Module_loading_failed();
- }
-
- /*
- * We should get here only if there are XML parsing errors
- */
- return 0;
- }
-
- /**
- * Copy command line to specified buffer
- *
- * \return length of command line in bytes, or 0 if module does not exist
- */
- Genode::size_t cmdline(int module_index,
- char *dst, Genode::size_t dst_len) const
- {
- using namespace Genode;
-
- try {
- Xml_node mod_node = _multiboot_node.sub_node(module_index);
-
- if (mod_node.has_type("rom") || mod_node.has_type("inline")) {
-
- Genode::size_t cmd_len = 0;
-
- Name const name = mod_node.attribute_value("name", Name());
-
- Genode::size_t const name_len = Genode::strlen(name.string());
-
- /*
- * Check if destination buffer can hold the name including
- * the zero termination.
- */
- if (name_len + 1 >= dst_len)
- return 0;
-
- /* copy name to command line */
- copy_cstring(&dst[cmd_len], name.string(), name_len + 1);
- cmd_len += name_len;
-
- /* check if name fills entire destination buffer */
- if (cmd_len + 1 == dst_len) {
- dst[cmd_len++] = 0;
- return cmd_len;
- }
-
- if (mod_node.has_attribute("cmdline")) {
-
- typedef String<256> Cmdline;
- Cmdline const cmdline = mod_node.attribute_value("cmdline", Cmdline());
-
- /* add single space between name and arguments */
- dst[cmd_len++] = ' ';
- if (cmd_len + 1 == dst_len) {
- dst[cmd_len++] = 0;
- return cmd_len;
- }
-
- /* copy 'cmdline' attribute to destination buffer */
- copy_cstring(&dst[cmd_len], cmdline.string(), dst_len - cmd_len);
-
- /*
- * The string returned by the 'value' function is
- * zero-terminated. Count and return the total number
- * of command-line characters.
- */
- return Genode::strlen(dst);
-
- }
-
- return cmd_len;
- }
-
- warning("XML node ", module_index, " in multiboot node has unexpected type");
-
- return 0;
- }
- catch (Xml_node::Nonexistent_sub_node) { }
-
- /*
- * We should get here only if there are XML parsing errors
- */
- return 0;
- }
-};
-
-#endif /* _BOOT_MODULE_PROVIDER_H_ */
diff --git a/repos/ports/src/app/seoul/component.cc b/repos/ports/src/app/seoul/component.cc
deleted file mode 100644
index 06f9986a1a..0000000000
--- a/repos/ports/src/app/seoul/component.cc
+++ /dev/null
@@ -1,1458 +0,0 @@
-/*
- * \brief Seoul component for Genode
- * \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 Seoul/Vancouver VMM, which is distributed
- * under the terms of the GNU General Public License version 2.
- *
- * Modifications by Intel Corporation are contributed under the terms and
- * conditions of the GNU General Public License version 2.
- */
-
-/* base includes */
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-/* os includes */
-#include
-#include
-#include
-#include
-
-#include
-
-/* Seoul includes as used by NOVA userland (NUL) */
-#include
-#include
-
-/* utilities includes */
-#include
-
-/* local includes */
-#include "synced_motherboard.h"
-#include "device_model_registry.h"
-#include "boot_module_provider.h"
-#include "console.h"
-#include "network.h"
-#include "disk.h"
-#include "state.h"
-#include "guest_memory.h"
-#include "timeout_late.h"
-
-
-enum { verbose_debug = false };
-enum { verbose_npt = false };
-enum { verbose_io = false };
-
-
-using Genode::Attached_rom_dataspace;
-
-typedef Genode::Synced_interface > Synced_timeout_list;
-
-class Timeouts
-{
- private:
-
- Timer::Connection _timer;
- Synced_motherboard &_motherboard;
- Synced_timeout_list &_timeouts;
- Genode::Signal_handler _timeout_sigh;
- Late_timeout _late { };
-
- Genode::uint64_t _check_and_wakeup()
- {
- Late_timeout::Remote const timeout_remote = _late.reset();
-
- timevalue const now = _motherboard()->clock()->time();
-
- unsigned timer_nr;
- unsigned timeout_count = 0;
-
- while ((timer_nr = _timeouts()->trigger(now))) {
-
- if (timeout_count == 0 && _late.apply(timeout_remote,
- timer_nr, now))
- {
- return _motherboard()->clock()->abstime(1, 1000);
- }
-
- MessageTimeout msg(timer_nr, _timeouts()->timeout());
-
- if (_timeouts()->cancel(timer_nr) < 0)
- Logging::printf("Timeout not cancelled.\n");
-
- _motherboard()->bus_timeout.send(msg);
-
- timeout_count++;
- }
-
- return _timeouts()->timeout();
- }
-
- void check_timeouts()
- {
- Genode::uint64_t const next = _check_and_wakeup();
-
- if (next == ~0ULL)
- return;
-
- timevalue rel_timeout_us = _motherboard()->clock()->delta(next, 1000 * 1000);
- if (rel_timeout_us == 0)
- rel_timeout_us = 1;
-
- _timer.trigger_once(rel_timeout_us);
- }
-
- public:
-
- void reprogram(Clock &clock, MessageTimer const &msg)
- {
- _late.timeout(clock, msg);
- Genode::Signal_transmitter(_timeout_sigh).submit();
- }
-
- /**
- * Constructor
- */
- Timeouts(Genode::Env &env, Synced_motherboard &mb,
- Synced_timeout_list &timeouts)
- :
- _timer(env),
- _motherboard(mb),
- _timeouts(timeouts),
- _timeout_sigh(env.ep(), *this, &Timeouts::check_timeouts)
- {
- _timer.sigh(_timeout_sigh);
- }
-
-};
-
-
-class Vcpu : public StaticReceiver
-{
-
- private:
-
- Genode::Vm_connection &_vm_con;
- Genode::Vcpu_handler _handler;
- bool const _vmx;
- bool const _svm;
- bool const _map_small;
- bool const _rdtsc_exit;
- Genode::Vm_connection::Exit_config _exit_config { };
- Genode::Vm_connection::Vcpu _vm_vcpu;
- Genode::Vcpu_state &_state;
-
- Seoul::Guest_memory &_guest_memory;
- Synced_motherboard &_motherboard;
- Genode::Synced_interface _vcpu;
-
- CpuState _seoul_state { };
-
- Genode::Semaphore _block { 0 };
-
- public:
-
- Vcpu(Genode::Entrypoint &ep,
- Genode::Vm_connection &vm_con,
- Genode::Allocator &alloc, Genode::Env &env,
- Genode::Mutex &vcpu_mutex, VCpu *unsynchronized_vcpu,
- Seoul::Guest_memory &guest_memory, Synced_motherboard &motherboard,
- bool vmx, bool svm, bool map_small, bool rdtsc)
- :
- _vm_con(vm_con),
- _handler(ep, *this, &Vcpu::_handle_vm_exception),
-// vmx ? &Vcpu::exit_config_intel :
-// svm ? &Vcpu::exit_config_amd : nullptr),
- _vmx(vmx), _svm(svm), _map_small(map_small), _rdtsc_exit(rdtsc),
- _vm_vcpu(_vm_con, alloc, _handler, _exit_config),
- _state(_vm_vcpu.state()),
- _guest_memory(guest_memory),
- _motherboard(motherboard),
- _vcpu(vcpu_mutex, unsynchronized_vcpu)
- {
- if (!_svm && !_vmx)
- Logging::panic("no SVM/VMX available, sorry");
-
- _seoul_state.clear();
-
- /* handle cpuid overrides */
- unsynchronized_vcpu->executor.add(this, receive_static);
-
- /* let vCPU run */
- _vm_vcpu.run();
- }
-
- void block() { _block.down(); }
- void unblock() { _block.up(); }
-
- void recall() { _vm_vcpu.pause(); }
-
- void _handle_vm_exception()
- {
- unsigned const exit = _state.exit_reason;
-
- if (_svm) {
- switch (exit) {
- case 0x00 ... 0x1f: _svm_cr(); break;
- case 0x62: _irqwin(); break;
- case 0x64: _irqwin(); break;
- case 0x6e: _svm_rdtsc(); break;
- case 0x72: _svm_cpuid(); break;
- case 0x78: _svm_hlt(); break;
- case 0x7b: _svm_ioio(); break;
- case 0x7c: _svm_msr(); break;
- case 0x7f: _triple(); break;
- case 0xfd: _svm_invalid(); break;
- case 0xfc: _svm_npt(); break;
- case 0xfe: _svm_startup(); break;
- case 0xff: _recall(); break;
- default:
- Genode::error(__func__, " exit=", Genode::Hex(exit));
- /* no resume */
- return;
- }
- }
- if (_vmx) {
- switch (exit) {
- case 0x02: _triple(); break;
- case 0x03: _vmx_init(); break;
- case 0x07: _irqwin(); break;
- case 0x0a: _vmx_cpuid(); break;
- case 0x0c: _vmx_hlt(); break;
- case 0x10: _vmx_rdtsc(); break;
- case 0x12: _vmx_vmcall(); break;
- case 0x1c: _vmx_mov_crx(); break;
- case 0x1e: _vmx_ioio(); break;
- case 0x1f: _vmx_msr_read(); break;
- case 0x20: _vmx_msr_write(); break;
- case 0x21: _vmx_invalid(); break;
- case 0x28: _vmx_pause(); break;
- case 0x30: _vmx_ept(); break;
- case 0xfe: _vmx_startup(); break;
- case 0xff: _recall(); break;
- default:
- Genode::error(__func__, " exit=", Genode::Hex(exit));
- /* no resume */
- return;
- }
- }
-
- /* resume */
- _vm_vcpu.run();
- }
-
- void exit_config_intel(Genode::Vcpu_state &state, unsigned exit)
- {
- CpuState dummy_state;
- unsigned mtd = 0;
-
- /* touch the register state required for the specific vm exit */
-
- switch (exit) {
- case 0x02: /* _triple */
- mtd = MTD_ALL;
- break;
- case 0x03: /* _vmx_init */
- mtd = MTD_ALL;
- break;
- case 0x07: /* _vmx_irqwin */
- mtd = MTD_IRQ;
- break;
- case 0x0a: /* _vmx_cpuid */
- mtd = MTD_RIP_LEN | MTD_GPR_ACDB | MTD_STATE;
- break;
- case 0x0c: /* _vmx_hlt */
- mtd = MTD_RIP_LEN | MTD_IRQ;
- break;
- case 0x10: /* _vmx_rdtsc */
- mtd = MTD_RIP_LEN | MTD_GPR_ACDB | MTD_TSC | MTD_STATE;
- break;
- case 0x12: /* _vmx_vmcall */
- mtd = MTD_RIP_LEN | MTD_GPR_ACDB;
- break;
- case 0x1c: /* _vmx_mov_crx */
- mtd = MTD_ALL;
- break;
- case 0x1e: /* _vmx_ioio */
- mtd = MTD_RIP_LEN | MTD_QUAL | MTD_GPR_ACDB | MTD_STATE | MTD_RFLAGS;
- break;
- case 0x28: /* _vmx_pause */
- mtd = MTD_RIP_LEN | MTD_STATE;
- break;
- case 0x1f: /* _vmx_msr_read */
- case 0x20: /* _vmx_msr_write */
- mtd = MTD_RIP_LEN | MTD_GPR_ACDB | MTD_TSC | MTD_SYSENTER | MTD_STATE;
- break;
- case 0x21: /* _vmx_invalid */
- case 0x30: /* _vmx_ept */
- case 0xfe: /* _vmx_startup */
- mtd = MTD_ALL;
- break;
- case 0xff: /* _recall */
- mtd = MTD_IRQ | MTD_RIP_LEN | MTD_GPR_ACDB | MTD_GPR_BSD;
- break;
- default:
-// mtd = MTD_RIP_LEN;
- break;
- }
-
- Seoul::write_vm_state(dummy_state, mtd, state);
- }
-
- void exit_config_amd(Genode::Vcpu_state &state, unsigned exit)
- {
- CpuState dummy_state;
- unsigned mtd = 0;
-
- /* touch the register state required for the specific vm exit */
-
- switch (exit) {
- case 0x00 ... 0x1f: /* _svm_cr */
- mtd = MTD_RIP_LEN | MTD_CS_SS | MTD_GPR_ACDB | MTD_GPR_BSD |
- MTD_CR | MTD_IRQ;
- break;
- case 0x72: /* _svm_cpuid */
- mtd = MTD_RIP_LEN | MTD_GPR_ACDB | MTD_IRQ;
- break;
- case 0x78: /* _svm_hlt */
- mtd = MTD_RIP_LEN | MTD_IRQ;
- break;
- case 0xff: /*_recall */
- case 0x62: /* _irqwin - SMI */
- case 0x64: /* _irqwin */
- mtd = MTD_IRQ;
- break;
- case 0x6e: /* _svm_rdtsc */
- mtd = MTD_RIP_LEN | MTD_GPR_ACDB | MTD_TSC | MTD_STATE;
- break;
- case 0x7b: /* _svm_ioio */
- mtd = MTD_RIP_LEN | MTD_QUAL | MTD_GPR_ACDB | MTD_STATE;
- break;
- case 0x7c: /* _svm_msr, MTD_ALL */
- case 0x7f: /* _triple, MTD_ALL */
- case 0xfd: /* _svm_invalid, MTD_ALL */
- case 0xfc: /*_svm_npt, MTD_ALL */
- case 0xfe: /*_svm_startup, MTD_ALL */
- mtd = MTD_ALL;
- break;
- default:
-// mtd = MTD_RIP_LEN;
- break;
- }
-
- Seoul::write_vm_state(dummy_state, mtd, state);
- }
-
- /***********************************
- ** Virtualization event handlers **
- ***********************************/
-
- static void _skip_instruction(CpuMessage &msg)
- {
- /* advance EIP */
- assert(msg.mtr_in & MTD_RIP_LEN);
- msg.cpu->eip += msg.cpu->inst_len;
- msg.mtr_out |= MTD_RIP_LEN;
-
- /* cancel sti and mov-ss blocking as we emulated an instruction */
- assert(msg.mtr_in & MTD_STATE);
- if (msg.cpu->intr_state & 3) {
- msg.cpu->intr_state &= ~3;
- msg.mtr_out |= MTD_STATE;
- }
- }
-
- enum Skip { SKIP = true, NO_SKIP = false };
-
- void _handle_vcpu(Skip skip, CpuMessage::Type type)
- {
- /* convert Genode VM state to Seoul state */
- unsigned mtd = Seoul::read_vm_state(_state, _seoul_state);
-
- CpuMessage msg(type, &_seoul_state, mtd);
-
- if (skip == SKIP)
- _skip_instruction(msg);
-
- /**
- * Send the message to the VCpu.
- */
- if (!_vcpu()->executor.send(msg, true))
- Logging::panic("nobody to execute %s at %x:%x\n",
- __func__, msg.cpu->cs.sel, msg.cpu->eip);
-
- /**
- * Check whether we should inject something...
- */
- if (msg.mtr_in & MTD_INJ && msg.type != CpuMessage::TYPE_CHECK_IRQ) {
- msg.type = CpuMessage::TYPE_CHECK_IRQ;
- if (!_vcpu()->executor.send(msg, true))
- Logging::panic("nobody to execute %s at %x:%x\n",
- __func__, msg.cpu->cs.sel, msg.cpu->eip);
- }
-
- /**
- * If the IRQ injection is performed, recalc the IRQ window.
- */
- if (msg.mtr_out & MTD_INJ) {
- msg.type = CpuMessage::TYPE_CALC_IRQWINDOW;
- if (!_vcpu()->executor.send(msg, true))
- Logging::panic("nobody to execute %s at %x:%x\n",
- __func__, msg.cpu->cs.sel, msg.cpu->eip);
- }
-
- if (~mtd & msg.mtr_out)
- Genode::error("mtd issue !? exit=", Genode::Hex(_state.exit_reason),
- " ", Genode::Hex(mtd), "->", Genode::Hex(msg.mtr_out),
- " ", Genode::Hex(~mtd & msg.mtr_out));
-
- /* convert Seoul state to Genode VM state */
- Seoul::write_vm_state(_seoul_state, msg.mtr_out, _state);
- }
-
- bool _handle_map_memory(bool need_unmap)
- {
- Genode::addr_t const vm_fault_addr = _state.qual_secondary.value();
-
- if (verbose_npt)
- Logging::printf("--> request mapping at 0x%lx\n", vm_fault_addr);
-
- MessageMemRegion mem_region(vm_fault_addr >> Vmm::PAGE_SIZE_LOG2);
-
- if (!_motherboard()->bus_memregion.send(mem_region, false) ||
- !mem_region.ptr)
- return false;
-
- if (verbose_npt)
- Logging::printf("VM page 0x%lx in [0x%lx:0x%lx),"
- " VMM area: [0x%lx:0x%lx)\n",
- mem_region.page, mem_region.start_page,
- mem_region.start_page + mem_region.count,
- (Genode::addr_t)mem_region.ptr >> Vmm::PAGE_SIZE_LOG2,
- ((Genode::addr_t)mem_region.ptr >> Vmm::PAGE_SIZE_LOG2)
- + mem_region.count);
-
- Genode::addr_t vmm_memory_base =
- reinterpret_cast(mem_region.ptr);
- Genode::addr_t vmm_memory_fault = vmm_memory_base +
- (vm_fault_addr - (mem_region.start_page << Vmm::PAGE_SIZE_LOG2));
-
- /* XXX: Not yet supported by Seoul/Vancouver.
-
- bool read=true, write=true, execute=true;
- if (mem_region.attr == (DESC_TYPE_MEM | DESC_RIGHT_R)) {
- if (verbose_npt)
- Logging::printf("Mapping readonly to %p (err:%x, attr:%x)\n",
- vm_fault_addr, utcb->qual[0], mem_region.attr);
- write = execute = false;
- }*/
-
- if (need_unmap)
- Logging::panic("_handle_map_memory: need_unmap not handled, yet\n");
-
- assert(_state.inj_info.charged());
-
- /* EPT violation during IDT vectoring? */
- if (_state.inj_info.value() & 0x80000000U) {
- /* convert Genode VM state to Seoul state */
- unsigned mtd = Seoul::read_vm_state(_state, _seoul_state);
- assert(mtd & MTD_INJ);
-
- Logging::printf("EPT violation during IDT vectoring.\n");
-
- CpuMessage _win(CpuMessage::TYPE_CALC_IRQWINDOW, &_seoul_state, mtd);
- _win.mtr_out = MTD_INJ;
- if (!_vcpu()->executor.send(_win, true))
- Logging::panic("nobody to execute %s at %x:%x\n",
- __func__, _seoul_state.cs.sel, _seoul_state.eip);
-
- /* convert Seoul state to Genode VM state */
- Seoul::write_vm_state(_seoul_state, _win.mtr_out, _state);
-// _state.inj_info.charge(_state.inj_info.value() & ~0x80000000U);
- } else
- _state.discharge(); /* reset */
-
- _vm_con.with_upgrade([&]() {
- if (_map_small)
- _guest_memory.attach_to_vm(_vm_con,
- mem_region.page << Vmm::PAGE_SIZE_LOG2,
- 1 << Vmm::PAGE_SIZE_LOG2);
- else
- _guest_memory.attach_to_vm(_vm_con,
- mem_region.start_page << Vmm::PAGE_SIZE_LOG2,
- mem_region.count << Vmm::PAGE_SIZE_LOG2);
- });
-
- return true;
- }
-
- void _handle_io(bool is_in, unsigned io_order, unsigned port)
- {
- if (verbose_io)
- Logging::printf("--> I/O is_in=%d, io_order=%d, port=%x\n",
- is_in, io_order, port);
-
- /* convert Genode VM state to Seoul state */
- unsigned mtd = Seoul::read_vm_state(_state, _seoul_state);
-
- Genode::addr_t ax = _state.ax.value();
-
- CpuMessage msg(is_in, &_seoul_state, io_order,
- port, &ax, mtd);
-
- _skip_instruction(msg);
-
- if (!_vcpu()->executor.send(msg, true))
- Logging::panic("nobody to execute %s at %x:%x\n",
- __func__, msg.cpu->cs.sel, msg.cpu->eip);
-
- if (ax != _seoul_state.rax)
- _seoul_state.rax = ax;
-
- /* convert Seoul state to Genode VM state */
- Seoul::write_vm_state(_seoul_state, msg.mtr_out, _state);
- }
-
- /* SVM portal functions */
- void _svm_startup()
- {
- _handle_vcpu(NO_SKIP, CpuMessage::TYPE_CHECK_IRQ);
- _state.ctrl_primary.charge(_rdtsc_exit ? (1U << 14) : 0);
- }
-
- void _svm_npt()
- {
- if (!_handle_map_memory(_state.qual_primary.value() & 1))
- _svm_invalid();
- }
-
- void _svm_cr()
- {
- _handle_vcpu(NO_SKIP, CpuMessage::TYPE_SINGLE_STEP);
- }
-
- void _svm_invalid()
- {
- _handle_vcpu(NO_SKIP, CpuMessage::TYPE_SINGLE_STEP);
- _state.ctrl_primary.charge(1 << 18 /* cpuid */ | (_rdtsc_exit ? (1U << 14) : 0));
- _state.ctrl_secondary.charge(1 << 0 /* vmrun */);
- }
-
- void _svm_ioio()
- {
- if (_state.qual_primary.value() & 0x4) {
- Genode::log("invalid gueststate");
- _state.discharge(); /* reset */
- _state.ctrl_secondary.charge(0);
- } else {
- unsigned order = ((_state.qual_primary.value() >> 4) & 7) - 1;
-
- if (order > 2)
- order = 2;
-
- _state.ip_len.charge(_state.qual_secondary.value() - _state.ip.value());
-
- _handle_io(_state.qual_primary.value() & 1, order,
- _state.qual_primary.value() >> 16);
- }
- }
-
- void _svm_cpuid()
- {
- _state.ip_len.charge(2);
- _handle_vcpu(SKIP, CpuMessage::TYPE_CPUID);
- }
-
- void _svm_hlt()
- {
- _state.ip_len.charge(1);
- _vmx_hlt();
- }
-
- void _svm_rdtsc()
- {
- _state.ip_len.charge(2);
- _handle_vcpu(SKIP, CpuMessage::TYPE_RDTSC);
- }
-
- void _svm_msr()
- {
- _svm_invalid();
- }
-
- void _recall()
- {
- _handle_vcpu(NO_SKIP, CpuMessage::TYPE_CHECK_IRQ);
- }
-
- void _irqwin()
- {
- _handle_vcpu(NO_SKIP, CpuMessage::TYPE_CHECK_IRQ);
- }
-
- void _triple()
- {
- _handle_vcpu(NO_SKIP, CpuMessage::TYPE_TRIPLE);
- }
-
- void _vmx_init()
- {
- _handle_vcpu(NO_SKIP, CpuMessage::TYPE_INIT);
- }
-
- void _vmx_hlt()
- {
- _handle_vcpu(SKIP, CpuMessage::TYPE_HLT);
- }
-
- void _vmx_rdtsc()
- {
- _handle_vcpu(SKIP, CpuMessage::TYPE_RDTSC);
- }
-
- void _vmx_vmcall()
- {
- _state.discharge(); /* reset */
- _state.ip.charge(_state.ip.value() + _state.ip_len.value());
- }
-
- void _vmx_pause()
- {
- /* convert Genode VM state to Seoul state */
- unsigned mtd = Seoul::read_vm_state(_state, _seoul_state);
-
- CpuMessage msg(CpuMessage::TYPE_SINGLE_STEP, &_seoul_state, mtd);
-
- _skip_instruction(msg);
-
- /* convert Seoul state to Genode VM state */
- Seoul::write_vm_state(_seoul_state, msg.mtr_out, _state);
- }
-
- void _vmx_invalid()
- {
- _state.flags.charge(_state.flags.value() | 2);
- _handle_vcpu(NO_SKIP, CpuMessage::TYPE_SINGLE_STEP);
- }
-
- void _vmx_startup()
- {
- _handle_vcpu(NO_SKIP, CpuMessage::TYPE_HLT);
- _state.ctrl_primary.charge(_rdtsc_exit ? (1U << 12) : 0);
- _state.ctrl_secondary.charge(0);
- }
-
- void _vmx_ioio()
- {
- unsigned order = 0U;
- if (_state.qual_primary.value() & 0x10) {
- Logging::printf("invalid gueststate\n");
- assert(_state.flags.charged());
- _state.discharge(); /* reset */
- _state.flags.charge(_state.flags.value() & ~2U);
- } else {
- order = _state.qual_primary.value() & 7;
- if (order > 2) order = 2;
-
- _handle_io(_state.qual_primary.value() & 8, order,
- _state.qual_primary.value() >> 16);
- }
- }
-
- void _vmx_ept()
- {
- if (!_handle_map_memory(_state.qual_primary.value() & 0x38))
- /* this is an access to MMIO */
- _handle_vcpu(NO_SKIP, CpuMessage::TYPE_SINGLE_STEP);
- }
-
- void _vmx_cpuid()
- {
- _handle_vcpu(SKIP, CpuMessage::TYPE_CPUID);
- }
-
- void _vmx_msr_read()
- {
- _handle_vcpu(SKIP, CpuMessage::TYPE_RDMSR);
- }
-
- void _vmx_msr_write()
- {
- _handle_vcpu(SKIP, CpuMessage::TYPE_WRMSR);
- }
-
- void _vmx_mov_crx()
- {
- _handle_vcpu(NO_SKIP, CpuMessage::TYPE_SINGLE_STEP);
- }
-
- /***********************************
- ** Handlers for 'StaticReceiver' **
- ***********************************/
-
- bool receive(CpuMessage &msg)
- {
- if (msg.type != CpuMessage::TYPE_CPUID)
- return false;
-
- /*
- * Linux kernels with guest KVM support compiled in, executed
- * CPUID to query the presence of KVM.
- */
- enum { CPUID_KVM_SIGNATURE = 0x40000000 };
-
- switch (msg.cpuid_index) {
-
- case CPUID_KVM_SIGNATURE:
-
- msg.cpu->eax = 0;
- msg.cpu->ebx = 0;
- msg.cpu->ecx = 0;
- msg.cpu->edx = 0;
- return true;
- case 0x80000007U:
- /* Bit 8 of edx indicates whether invariant TSC is supported */
- msg.cpu->eax = msg.cpu->ebx = msg.cpu->ecx = msg.cpu->edx = 0;
- return true;
- default:
- Logging::printf("CpuMessage::TYPE_CPUID index %x ignored\n",
- msg.cpuid_index);
- }
- return true;
- }
-};
-
-
-
-class Machine : public StaticReceiver
-{
- private:
-
- Genode::Env &_env;
- Genode::Heap &_heap;
- Genode::Vm_connection &_vm_con;
- Clock _clock;
- Genode::Mutex _motherboard_mutex { };
- Motherboard _unsynchronized_motherboard;
- Synced_motherboard _motherboard;
- Genode::Mutex _timeouts_mutex { };
- TimeoutList<32, void> _unsynchronized_timeouts { };
- Synced_timeout_list _timeouts;
- Seoul::Guest_memory &_guest_memory;
- Boot_module_provider &_boot_modules;
- Timeouts _alarm_thread = { _env, _motherboard, _timeouts };
- unsigned short _vcpus_up = 0;
-
- Genode::addr_t _alloc_fb_size { 0 };
- Genode::addr_t _alloc_fb_mem { 0 };
- Genode::addr_t _vm_phys_fb { 0 };
-
- bool _map_small { false };
- bool _rdtsc_exit { false };
- bool _same_cpu { false };
- Seoul::Network *_nic { nullptr };
- Rtc::Session *_rtc { nullptr };
-
- enum { MAX_CPUS = 8 };
- Vcpu * _vcpus[MAX_CPUS] { nullptr };
- Genode::Bit_array<64> _vcpus_active { };
-
- /*
- * Noncopyable
- */
- Machine(Machine const &);
- Machine &operator = (Machine const &);
-
- public:
-
- /*********************************************
- ** Callbacks registered at the motherboard **
- *********************************************/
-
- bool receive(MessageHostOp &msg)
- {
- switch (msg.type) {
-
- case MessageHostOp::OP_ALLOC_IOMEM:
- {
- if (msg.len & 0xfff)
- return false;
-
- Genode::addr_t const guest_addr = msg.value;
- try {
- Genode::Dataspace_capability ds = _env.ram().alloc(msg.len);
- Genode::addr_t local_addr = _env.rm().attach(ds);
- _guest_memory.add_region(_heap, guest_addr, local_addr, ds, msg.len);
- msg.ptr = reinterpret_cast(local_addr);
- return true;
- } catch (...) {
- return false;
- }
- }
- /**
- * Request available guest memory starting at specified address
- */
- case MessageHostOp::OP_GUEST_MEM:
-
- if (verbose_debug)
- Logging::printf("OP_GUEST_MEM value=0x%lx\n", msg.value);
-
- if (_alloc_fb_mem) {
- msg.len = _alloc_fb_size;
- msg.ptr = (char *)_alloc_fb_mem - _vm_phys_fb;
- _alloc_fb_mem = _alloc_fb_size = _vm_phys_fb = 0;
- return true;
- }
-
- if (msg.value >= _guest_memory.remaining_size) {
- msg.value = 0;
- } else {
- msg.len = _guest_memory.remaining_size - msg.value;
- msg.ptr = _guest_memory.backing_store_local_base() + msg.value;
- }
-
- if (verbose_debug)
- Logging::printf(" -> len=0x%zx, ptr=0x%p\n",
- msg.len, msg.ptr);
- return true;
-
- /**
- * Cut off upper range of guest memory by specified amount
- */
- case MessageHostOp::OP_ALLOC_FROM_GUEST:
-
- if (verbose_debug)
- Logging::printf("OP_ALLOC_FROM_GUEST\n");
-
- if (_alloc_fb_mem) {
- msg.phys = _vm_phys_fb;
- return true;
- }
-
- if (msg.value > _guest_memory.remaining_size)
- return false;
-
- _guest_memory.remaining_size -= msg.value;
-
- msg.phys = _guest_memory.remaining_size;
-
- if (verbose_debug)
- Logging::printf("-> allocated from guest %08lx+%lx\n",
- msg.phys, msg.value);
- return true;
-
- case MessageHostOp::OP_VCPU_CREATE_BACKEND:
- {
- enum { STACK_SIZE = 2*1024*sizeof(Genode::addr_t) };
-
- if (verbose_debug)
- Logging::printf("OP_VCPU_CREATE_BACKEND\n");
-
- if (_vcpus_up >= sizeof(_vcpus)/sizeof(_vcpus[0])) {
- Logging::panic("too many vCPUs");
- return false;
- }
-
- /* detect virtualization extension */
- Attached_rom_dataspace const info(_env, "platform_info");
- Genode::Xml_node const features = info.xml().sub_node("hardware").sub_node("features");
-
- bool const has_svm = features.attribute_value("svm", false);
- bool const has_vmx = features.attribute_value("vmx", false);
-
- if (!has_svm && !has_vmx) {
- Logging::panic("no VMX nor SVM virtualization support found");
- return false;
- }
-
- using Genode::Entrypoint;
- using Genode::String;
- using Genode::Affinity;
-
- Affinity::Space space = _env.cpu().affinity_space();
- Affinity::Location location(space.location_of_index(_vcpus_up + (_same_cpu ? 0 : 1)));
-
- String<16> * ep_name = new String<16>("vCPU EP ", _vcpus_up);
- Entrypoint * ep = new Entrypoint(_env, STACK_SIZE,
- ep_name->string(),
- location);
-
- _vcpus_active.set(_vcpus_up, 1);
-
- Vcpu * vcpu = new Vcpu(*ep, _vm_con, _heap, _env,
- _motherboard_mutex, msg.vcpu,
- _guest_memory, _motherboard,
- has_vmx, has_svm, _map_small,
- _rdtsc_exit);
-
- _vcpus[_vcpus_up] = vcpu;
- msg.value = _vcpus_up;
-
- Logging::printf("create vcpu %u affinity %u:%u\n",
- _vcpus_up, location.xpos(), location.ypos());
-
- _vcpus_up ++;
-
- return true;
- }
-
- case MessageHostOp::OP_VCPU_RELEASE:
- {
- if (verbose_debug)
- Genode::log("- OP_VCPU_RELEASE ", Genode::Thread::myself()->name());
-
- unsigned vcpu_id = msg.value;
- if ((_vcpus_up >= sizeof(_vcpus)/sizeof(_vcpus[0])))
- return false;
-
- if (!_vcpus[vcpu_id])
- return false;
-
- if (msg.len) {
- _vcpus[vcpu_id]->unblock();
- return true;
- }
-
- _vcpus[vcpu_id]->recall();
- return true;
- }
- case MessageHostOp::OP_VCPU_BLOCK:
- {
- if (verbose_debug)
- Genode::log("- OP_VCPU_BLOCK ", Genode::Thread::myself()->name());
-
- unsigned vcpu_id = msg.value;
- if ((_vcpus_up >= sizeof(_vcpus)/sizeof(_vcpus[0])))
- return false;
-
- if (!_vcpus[vcpu_id])
- return false;
-
- _vcpus_active.clear(vcpu_id, 1);
-
- if (!_vcpus_active.get(0, 64)) {
- MessageConsole msgcon(MessageConsole::Type::TYPE_KILL);
- _unsynchronized_motherboard.bus_console.send(msgcon);
- }
-
- _motherboard_mutex.release();
-
- _vcpus[vcpu_id]->block();
-
- _motherboard_mutex.acquire();
-
- if (!_vcpus_active.get(0, 64)) {
- MessageConsole msgcon(MessageConsole::Type::TYPE_RESET);
- _unsynchronized_motherboard.bus_console.send(msgcon);
- }
-
- _vcpus_active.set(vcpu_id, 1);
-
- return true;
- }
-
- case MessageHostOp::OP_GET_MODULE:
- {
- /*
- * Module indices start with 1
- */
- if (msg.module == 0)
- return false;
-
- /*
- * Message arguments
- */
- int const index = msg.module - 1;
- char * const data_dst = msg.start;
- Genode::size_t const dst_len = msg.size;
-
- /*
- * Copy module data to guest RAM
- */
- Genode::size_t data_len = 0;
- try {
- data_len = _boot_modules.data(_env, index,
- data_dst, dst_len);
- } catch (Boot_module_provider::Destination_buffer_too_small) {
- Logging::panic("could not load module, destination buffer too small\n");
- return false;
- } catch (Boot_module_provider::Module_loading_failed) {
- Logging::panic("could not load module %d,"
- " unknown reason\n", index);
- return false;
- }
-
- /*
- * Detect end of module list
- */
- if (data_len == 0)
- return false;
-
- /*
- * Determine command line offset relative to the start of
- * the loaded boot module. The command line resides right
- * behind the module data, aligned on a page boundary.
- */
- Genode::addr_t const cmdline_offset =
- Genode::align_addr(data_len, Vmm::PAGE_SIZE_LOG2);
-
- if (cmdline_offset >= dst_len) {
- Logging::printf("destination buffer too small for command line\n");
- return false;
- }
-
- /*
- * Copy command line to guest RAM
- */
- Genode::size_t const cmdline_len =
- _boot_modules.cmdline(index, data_dst + cmdline_offset,
- dst_len - cmdline_offset);
-
- /*
- * Return module size (w/o the size of the command line,
- * the 'vbios_multiboot' is aware of the one-page gap
- * between modules.
- */
- msg.size = data_len;
- msg.cmdline = data_dst + cmdline_offset;
- msg.cmdlen = cmdline_len;
-
- return true;
- }
- case MessageHostOp::OP_GET_MAC:
- {
- if (_nic) {
- Logging::printf("Solely one network connection supported\n");
- return false;
- }
-
- try {
- _nic = new (_heap) Seoul::Network(_env, _heap,
- _motherboard);
- } catch (...) {
- Logging::printf("Creating network connection failed\n");
- return false;
- }
-
- Nic::Mac_address mac = _nic->mac_address();
-
- Logging::printf("Mac address: %2x:%2x:%2x:%2x:%2x:%2x\n",
- mac.addr[0], mac.addr[1], mac.addr[2],
- mac.addr[3], mac.addr[4], mac.addr[5]);
-
- msg.mac = ((Genode::uint64_t)mac.addr[0] & 0xff) << 40 |
- ((Genode::uint64_t)mac.addr[1] & 0xff) << 32 |
- ((Genode::uint64_t)mac.addr[2] & 0xff) << 24 |
- ((Genode::uint64_t)mac.addr[3] & 0xff) << 16 |
- ((Genode::uint64_t)mac.addr[4] & 0xff) << 8 |
- ((Genode::uint64_t)mac.addr[5] & 0xff);
-
- return true;
- }
- default:
-
- Logging::printf("HostOp %d not implemented\n", msg.type);
- return false;
- }
- }
-
- bool receive(MessageTimer &msg)
- {
- switch (msg.type) {
- case MessageTimer::TIMER_NEW:
-
- if (verbose_debug)
- Logging::printf("TIMER_NEW\n");
-
- msg.nr = _timeouts()->alloc();
-
- return true;
-
- case MessageTimer::TIMER_REQUEST_TIMEOUT:
- {
- int res = _timeouts()->request(msg.nr, msg.abstime);
-
- if (res == 0)
- _alarm_thread.reprogram(_clock, msg);
- else
- if (res < 0)
- Logging::printf("Could not program timeout.\n");
-
- return true;
- }
- default:
- return false;
- };
- }
-
- bool receive(MessageTime &msg)
- {
- if (!_rtc) {
- try {
- _rtc = new Rtc::Connection(_env);
- } catch (...) {
- Logging::printf("No RTC present, returning dummy time.\n");
- msg.wallclocktime = msg.timestamp = 0;
- return true;
- }
- }
-
- Rtc::Timestamp rtc_ts = _rtc->current_time();
- tm_simple tms(rtc_ts.year, rtc_ts.month, rtc_ts.day, rtc_ts.hour,
- rtc_ts.minute, rtc_ts.second);
-
- msg.wallclocktime = mktime(&tms) * MessageTime::FREQUENCY;
- Logging::printf("Got time %llx\n", msg.wallclocktime);
- msg.timestamp = _unsynchronized_motherboard.clock()->clock(MessageTime::FREQUENCY);
-
- return true;
- }
-
- bool receive(MessageNetwork &msg)
- {
- if (msg.type != MessageNetwork::PACKET) return false;
-
- if (!_nic)
- return false;
-
- /* XXX parallel invocations supported ? */
- return _nic->transmit(msg.buffer, msg.len);
- }
-
- bool receive(MessagePciConfig &msg)
- {
- if (verbose_debug)
- Logging::printf("MessagePciConfig\n");
- return false;
- }
-
- bool receive(MessageAcpi &msg)
- {
- if (verbose_debug)
- Logging::printf("MessageAcpi\n");
- return false;
- }
-
- bool receive(MessageLegacy &msg)
- {
- if (msg.type == MessageLegacy::RESET) {
- Logging::printf("MessageLegacy::RESET requested\n");
- return true;
- }
- return false;
- }
-
- /**
- * Constructor
- */
- Machine(Genode::Env &env, Genode::Heap &heap,
- Genode::Vm_connection &vm_con,
- Boot_module_provider &boot_modules,
- Seoul::Guest_memory &guest_memory,
- size_t const fb_size,
- bool map_small, bool rdtsc_exit, bool vmm_vcpu_same_cpu)
- :
- _env(env), _heap(heap), _vm_con(vm_con),
- _clock(Attached_rom_dataspace(env, "platform_info").xml().sub_node("hardware").sub_node("tsc").attribute_value("freq_khz", 0ULL) * 1000ULL),
- _unsynchronized_motherboard(&_clock, nullptr),
- _motherboard(_motherboard_mutex, &_unsynchronized_motherboard),
- _timeouts(_timeouts_mutex, &_unsynchronized_timeouts),
- _guest_memory(guest_memory),
- _boot_modules(boot_modules),
- _map_small(map_small),
- _rdtsc_exit(rdtsc_exit),
- _same_cpu(vmm_vcpu_same_cpu)
- {
- _motherboard_mutex.acquire();
-
- _timeouts()->init();
-
- /* register host operations, called back by the VMM */
- _unsynchronized_motherboard.bus_hostop.add (this, receive_static);
- _unsynchronized_motherboard.bus_timer.add (this, receive_static);
- _unsynchronized_motherboard.bus_time.add (this, receive_static);
- _unsynchronized_motherboard.bus_network.add (this, receive_static);
- _unsynchronized_motherboard.bus_hwpcicfg.add(this, receive_static);
- _unsynchronized_motherboard.bus_acpi.add (this, receive_static);
- _unsynchronized_motherboard.bus_legacy.add (this, receive_static);
-
- /* tell vga model about available framebuffer memory */
- Device_model_info *dmi = device_model_registry()->lookup("vga_fbsize");
- if (dmi) {
- unsigned long argv[2] = { fb_size >> 10, ~0UL };
- dmi->create(_unsynchronized_motherboard, argv, "", 0);
- }
- }
-
-
- /**
- * Exception type thrown on configuration errors
- */
- class Config_error { };
-
-
- /**
- * Configure virtual machine according to the provided XML description
- *
- * \param machine_node XML node containing device-model sub nodes
- * \throw Config_error
- *
- * Device models are instantiated in the order of appearance in the XML
- * configuration.
- */
- void setup_devices(Genode::Xml_node machine_node,
- Seoul::Console &console)
- {
- using namespace Genode;
-
- bool const verbose = machine_node.attribute_value("verbose", false);
-
- Xml_node node = machine_node.sub_node();
- for (;; node = node.next()) {
-
- typedef String<32> Model_name;
-
- Model_name const name = node.type();
-
- if (verbose)
- Genode::log("device: ", name);
-
- Device_model_info *dmi = device_model_registry()->lookup(name.string());
-
- if (!dmi) {
- Genode::error("configuration error: device model '",
- name, "' does not exist");
- throw Config_error();
- }
-
- /*
- * Read device-model arguments into 'argv' array
- */
- enum { MAX_ARGS = 8 };
- unsigned long argv[MAX_ARGS];
-
- for (int i = 0; i < MAX_ARGS; i++)
- argv[i] = ~0UL;
-
- for (int i = 0; dmi->arg_names[i] && (i < MAX_ARGS); i++) {
- if (node.has_attribute(dmi->arg_names[i])) {
- argv[i] = node.attribute_value(dmi->arg_names[i], ~0UL);
- if (verbose)
- Genode::log(" arg[", i, "]: ", Genode::Hex(argv[i]));
- }
- }
-
- /*
- * Initialize new instance of device model
- *
- * We never pass any argument string to a device model because
- * it is not examined by the existing device models.
- */
- if (!strcmp(dmi->name, "vga", 4)) {
- _alloc_fb_mem = console.attached_framebuffer();
- _alloc_fb_size = console.framebuffer_size();
- _vm_phys_fb = console.vm_phys_framebuffer();
- }
-
- dmi->create(_unsynchronized_motherboard, argv, "", 0);
-
- if (_alloc_fb_mem) _alloc_fb_mem = _alloc_fb_size = 0;
-
- if (node.last())
- break;
- }
- }
-
- /**
- * Reset the machine and unblock the VCPUs
- */
- void boot()
- {
- Genode::log("VM is starting with ", _vcpus_up, " vCPU",
- _vcpus_up > 1 ? "s" : "");
-
- /* init VCPUs */
- for (VCpu *vcpu = _unsynchronized_motherboard.last_vcpu; vcpu; vcpu = vcpu->get_last()) {
-
- /* init CPU strings */
- const char *short_name = "NOVA microHV";
- vcpu->set_cpuid(0, 1, reinterpret_cast(short_name)[0]);
- vcpu->set_cpuid(0, 3, reinterpret_cast(short_name)[1]);
- vcpu->set_cpuid(0, 2, reinterpret_cast(short_name)[2]);
- const char *long_name = "Seoul VMM proudly presents this VirtualCPU. ";
- for (unsigned i=0; i<12; i++)
- vcpu->set_cpuid(0x80000002 + (i / 4), i % 4, reinterpret_cast(long_name)[i]);
-
- /* propagate feature flags from the host */
- unsigned ebx_1=0, ecx_1=0, edx_1=0;
- Cpu::cpuid(1, ebx_1, ecx_1, edx_1);
-
- /* clflush size */
- vcpu->set_cpuid(1, 1, ebx_1 & 0xff00, 0xff00ff00);
-
- /* +SSE3,+SSSE3 */
- vcpu->set_cpuid(1, 2, ecx_1, 0x00000201);
-
- /* -PAE,-PSE36, -MTRR,+MMX,+SSE,+SSE2,+CLFLUSH,+SEP */
- vcpu->set_cpuid(1, 3, edx_1, 0x0f88a9bf | (1 << 28));
- }
-
- Logging::printf("RESET device state\n");
- MessageLegacy msg2(MessageLegacy::RESET, 0);
- _unsynchronized_motherboard.bus_legacy.send_fifo(msg2);
-
- Logging::printf("INIT done\n");
-
- _motherboard_mutex.release();
- }
-
- Synced_motherboard &motherboard() { return _motherboard; }
-
- Motherboard &unsynchronized_motherboard() { return _unsynchronized_motherboard; }
-};
-
-
-extern unsigned long _prog_img_beg; /* begin of program image (link address) */
-extern unsigned long _prog_img_end; /* end of program image */
-
-extern void heap_init_env(Genode::Heap *);
-
-void Component::construct(Genode::Env &env)
-{
- static Genode::Heap heap(env.ram(), env.rm());
- static Genode::Vm_connection vm_con(env, "Seoul vCPUs",
- Genode::Cpu_session::PRIORITY_LIMIT / 16);
-
- static Attached_rom_dataspace config(env, "config");
-
- Genode::log("--- Seoul VMM starting ---");
-
- Genode::Xml_node const node = config.xml();
- Genode::uint64_t const vmm_size = node.attribute_value("vmm_memory",
- Genode::Number_of_bytes(12 * 1024 * 1024));
-
- bool const map_small = node.attribute_value("map_small", false);
- bool const rdtsc_exit = node.attribute_value("exit_on_rdtsc", false);
- bool const vmm_vcpu_same_cpu = node.attribute_value("vmm_vcpu_same_cpu",
- false);
-
- /* request max available memory */
- Genode::uint64_t vm_size = env.pd().avail_ram().value;
- /* reserve some memory for the VMM */
- vm_size -= vmm_size;
- /* calculate max memory for the VM */
- vm_size = vm_size & ~((1ULL << Vmm::PAGE_SIZE_LOG2) - 1);
-
- Genode::log(" VMM memory ", Genode::Number_of_bytes(vmm_size));
- Genode::log(" using ", map_small ? "small": "large",
- " memory attachments for guest VM.");
- if (rdtsc_exit)
- Genode::log(" enabling VM exit on RDTSC.");
-
- unsigned const width = node.attribute_value("width", 1024U);
- unsigned const height = node.attribute_value("height", 768U);
-
- Genode::log(" framebuffer ", width, "x", height);
-
- /* setup framebuffer memory for guest */
- static Gui::Connection gui { env };
- gui.buffer(Framebuffer::Mode { .area = { width, height } }, false);
-
- static Framebuffer::Session &framebuffer { *gui.framebuffer() };
- Framebuffer::Mode const fb_mode { framebuffer.mode() };
-
- size_t const fb_size = Genode::align_addr(fb_mode.area.count() *
- fb_mode.bytes_per_pixel(), 12);
-
- typedef Gui::Session::View_handle View_handle;
- typedef Gui::Session::Command Command;
-
- View_handle view = gui.create_view();
- Gui::Rect rect(Gui::Point(0, 0), fb_mode.area);
-
- gui.enqueue(view, rect);
- gui.enqueue(view, View_handle());
- gui.execute();
-
- /* setup guest memory */
- static Seoul::Guest_memory guest_memory(env, heap, vm_con, vm_size);
-
- typedef Genode::Hex_range Hex_range;
-
- /* diagnostic messages */
- if (guest_memory.backing_store_local_base())
- Genode::log(Hex_range((unsigned long)guest_memory.backing_store_local_base(),
- guest_memory.remaining_size),
- " - ", vm_size / 1024 / 1024, " MiB",
- " - VMM accessible shadow mapping of VM memory");
-
- Genode::log(Hex_range((Genode::addr_t)&_prog_img_beg,
- (Genode::addr_t)&_prog_img_end -
- (Genode::addr_t)&_prog_img_beg),
- " - VMM program image");
-
- if (!guest_memory.backing_store_local_base()) {
- Genode::error("Not enough space left for ",
- guest_memory.backing_store_local_base() ? "framebuffer"
- : "VMM");
- env.parent().exit(-1);
- return;
- }
-
- /* register device models of Seoul, see device_model_registry.cc */
- env.exec_static_constructors();
-
- Genode::log("\n--- Setup VM ---");
-
- heap_init_env(&heap);
-
- static Boot_module_provider boot_modules(node.sub_node("multiboot"));
-
- /* create the PC machine based on the configuration given */
- static Machine machine(env, heap, vm_con, boot_modules, guest_memory,
- fb_size, map_small, rdtsc_exit, vmm_vcpu_same_cpu);
-
- /* create console thread */
- static Seoul::Console vcon(env, heap, machine.motherboard(),
- machine.unsynchronized_motherboard(),
- gui, guest_memory);
-
- vcon.register_host_operations(machine.unsynchronized_motherboard());
-
- /* create disk thread */
- static Seoul::Disk vdisk(env, machine.motherboard(),
- guest_memory.backing_store_local_base(),
- guest_memory.backing_store_size());
-
- vdisk.register_host_operations(machine.unsynchronized_motherboard());
-
- machine.setup_devices(node.sub_node("machine"), vcon);
-
- Genode::log("\n--- Booting VM ---");
-
- machine.boot();
-}
diff --git a/repos/ports/src/app/seoul/console.cc b/repos/ports/src/app/seoul/console.cc
deleted file mode 100644
index 2932079b9b..0000000000
--- a/repos/ports/src/app/seoul/console.cc
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * \brief Manager of all VM requested console functionality
- * \author Markus Partheymueller
- * \author Norman Feske
- * \author Alexander Boettcher
- * \date 2012-07-31
- */
-
-/*
- * Copyright (C) 2011-2017 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.
- *
- * Modifications by Intel Corporation are contributed under the terms and
- * conditions of the GNU General Public License version 2.
- */
-
-/* base includes */
-#include
-
-/* nitpicker graphics backend */
-#include
-
-#include
-#include
-
-/* local includes */
-#include "console.h"
-
-extern char _binary_mono_tff_start[];
-
-static Tff_font::Static_glyph_buffer<4096> glyph_buffer { };
-static Tff_font default_font(_binary_mono_tff_start, glyph_buffer);
-
-static struct {
- Genode::uint64_t checksum1 = 0;
- Genode::uint64_t checksum2 = 0;
- unsigned unchanged = 0;
- bool cmp_even = 1;
- bool active = false;
- bool vga_revoked = false;
- bool vga_update = false; /* update indirectly by vbios */
-} fb_state;
-
-
-/**
- * Layout of PS/2 mouse packet
- */
-struct Ps2_mouse_packet : Genode::Register<32>
-{
- struct Packet_size : Bitfield<0, 3> { };
- struct Left_button : Bitfield<8, 1> { };
- struct Middle_button : Bitfield<9, 1> { };
- struct Right_button : Bitfield<10, 1> { };
- struct Rx_high : Bitfield<12, 1> { };
- struct Ry_high : Bitfield<13, 1> { };
- struct Rx_low : Bitfield<16, 8> { };
- struct Ry_low : Bitfield<24, 8> { };
-};
-
-
-static bool mouse_event(Input::Event const &ev)
-{
- using namespace Input;
-
- bool result = false;
-
- auto mouse_button = [] (Keycode key) {
- return key == BTN_LEFT || key == BTN_MIDDLE || key == BTN_RIGHT; };
-
- ev.handle_press([&] (Keycode key, Genode::Codepoint) {
- result |= mouse_button(key); });
-
- ev.handle_release([&] (Keycode key) {
- result |= mouse_button(key); });
-
- result |= ev.absolute_motion() || ev.relative_motion();
- result |= ev.wheel();
-
- return result;
-}
-
-
-/**
- * Convert Genode::Input event to PS/2 packet
- *
- * This function updates _left, _middle, and _right as a side effect.
- */
-unsigned Seoul::Console::_input_to_ps2mouse(Input::Event const &ev)
-{
- /* track state of mouse buttons */
- auto apply_button = [] (Input::Event const &ev, Input::Keycode key, bool &state) {
- if (ev.key_press (key)) state = true;
- if (ev.key_release(key)) state = false;
- };
-
- apply_button(ev, Input::BTN_LEFT, _left);
- apply_button(ev, Input::BTN_MIDDLE, _middle);
- apply_button(ev, Input::BTN_RIGHT, _right);
-
- int rx = 0;
- int ry = 0;
-
- ev.handle_absolute_motion([&] (int x, int y) {
- static int ox = 0, oy = 0;
- rx = x - ox; ry = y - oy;
- ox = x; oy = y;
- });
-
- ev.handle_relative_motion([&] (int x, int y) { rx = x; ry = y; });
-
-
- /* clamp relative motion vector to bounds */
- int const boundary = 200;
- rx = Genode::min(boundary, Genode::max(-boundary, rx));
- ry = -Genode::min(boundary, Genode::max(-boundary, ry));
-
- /* assemble PS/2 packet */
- Ps2_mouse_packet::access_t packet = 0;
- Ps2_mouse_packet::Packet_size::set (packet, 3);
- Ps2_mouse_packet::Left_button::set (packet, _left);
- Ps2_mouse_packet::Middle_button::set(packet, _middle);
- Ps2_mouse_packet::Right_button::set (packet, _right);
- Ps2_mouse_packet::Rx_high::set (packet, (rx >> 8) & 1);
- Ps2_mouse_packet::Ry_high::set (packet, (ry >> 8) & 1);
- Ps2_mouse_packet::Rx_low::set (packet, rx & 0xff);
- Ps2_mouse_packet::Ry_low::set (packet, ry & 0xff);
-
- 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)
-{
- int rz = 0;
- ev.handle_wheel([&](int x, int y) { rz = y; });
-
- return (unsigned)rz;
-}
-
-
-/* bus callbacks */
-
-bool Seoul::Console::receive(MessageConsole &msg)
-{
- switch (msg.type) {
- case MessageConsole::TYPE_ALLOC_VIEW :
- _guest_fb = msg.ptr;
- _regs = msg.regs;
-
- msg.view = 0;
- return true;
- case MessageConsole::TYPE_SWITCH_VIEW:
- /* XXX: For now, we only have one view. */
- return true;
- case MessageConsole::TYPE_GET_MODEINFO:
- enum {
- MEMORY_MODEL_TEXT = 0,
- MEMORY_MODEL_DIRECT_COLOR = 6,
- };
-
- /*
- * We supply two modes to the guest, text mode and one
- * configured graphics mode 16-bit.
- */
- if (msg.index == 0) {
- msg.info->_vesa_mode = 3;
- msg.info->attr = 0x1;
- msg.info->resolution[0] = 80;
- msg.info->resolution[1] = 25;
- msg.info->bytes_per_scanline = 80*2;
- msg.info->bytes_scanline = 80*2;
- msg.info->bpp = 4;
- msg.info->memory_model = MEMORY_MODEL_TEXT;
- msg.info->phys_base = PHYS_FRAME_VGA_COLOR << 12;
- msg.info->_phys_size = FRAME_COUNT_COLOR << 12;
- return true;
-
- } else if (msg.index == 1) {
-
- /*
- * It's important to set the _vesa_mode field, otherwise the
- * device model is going to ignore this mode.
- */
- unsigned const bpp = _fb_mode.bytes_per_pixel();
- msg.info->_vesa_mode = 0x138;
- msg.info->attr = 0x39f;
- msg.info->resolution[0] = _fb_mode.area.w();
- msg.info->resolution[1] = _fb_mode.area.h();
- msg.info->bytes_per_scanline = _fb_mode.area.w()*bpp;
- msg.info->bytes_scanline = _fb_mode.area.w()*bpp;
- msg.info->bpp = 32;
- msg.info->memory_model = MEMORY_MODEL_DIRECT_COLOR;
- msg.info->vbe1[0] = 0x8; /* red mask size */
- msg.info->vbe1[1] = 0x10; /* red field position */
- msg.info->vbe1[2] = 0x8; /* green mask size */
- msg.info->vbe1[3] = 0x8; /* green field position */
- msg.info->vbe1[4] = 0x8; /* blue mask size */
- msg.info->vbe1[5] = 0x0; /* blue field position */
- msg.info->vbe1[6] = 0x0; /* reserved mask size */
- msg.info->vbe1[7] = 0x0; /* reserved field position */
- msg.info->colormode = 0x0; /* direct color mode info */
- msg.info->phys_base = 0xe0000000;
- msg.info->_phys_size = _fb_mode.area.count()*bpp;
- return true;
- }
- return false;
- case MessageConsole::TYPE_KILL: /* all CPUs go idle */
- _handle_fb(); /* refresh before going to sleep */
- fb_state.active = false;
- return true;
- case MessageConsole::TYPE_RESET: /* first of all sleeping CPUs woke up */
- _reactivate();
- return true;
- default:
- return true;
- }
-}
-
-void Screen::vga_updated()
-{
- fb_state.vga_update = true;
-}
-
-void Seoul::Console::_reactivate()
-{
- fb_state.active = true;
-
- MessageTimer msg(_timer, _unsynchronized_motherboard.clock()->abstime(1, 1000));
- _unsynchronized_motherboard.bus_timer.send(msg);
-}
-
-bool Seoul::Console::receive(MessageMemRegion &msg)
-{
- /* we had a fault in the text framebuffer */
- bool reactivate = (msg.page >= PHYS_FRAME_VGA &&
- msg.page < PHYS_FRAME_VGA_COLOR + FRAME_COUNT_COLOR);
-
- /* vga memory got changed indirectly by vbios */
- if (fb_state.vga_update) {
- fb_state.vga_update = false;
- if (!fb_state.active)
- reactivate = true;
- }
-
- if (reactivate) {
- fb_state.vga_revoked = false;
-
- //Logging::printf("Reactivating text buffer loop.\n");
-
- _reactivate();
- }
- return false;
-}
-
-
-unsigned Seoul::Console::_handle_fb()
-{
- if (!_guest_fb || !_regs)
- return 0;
-
- enum { TEXT_MODE = 0 };
-
- /* transfer text buffer content into chunky canvas */
- if (_regs->mode == TEXT_MODE) {
-
- if (fb_state.vga_revoked || !fb_state.active) return 0;
-
- memset(_pixels, 0, _fb_size);
-
- if (fb_state.cmp_even) fb_state.checksum1 = 0;
- else fb_state.checksum2 = 0;
-
- for (int j=0; j<25; j++) {
- for (int i=0; i<80; i++) {
- Text_painter::Position const where(i*8, j*15);
- char character = *((char *) (_guest_fb +(_regs->offset << 1) +j*80*2+i*2));
- char colorvalue = *((char *) (_guest_fb+(_regs->offset << 1)+j*80*2+i*2+1));
- char buffer[2]; buffer[0] = character; buffer[1] = 0;
- char fg = colorvalue & 0xf;
- if (fg == 0x8) fg = 0x7;
- unsigned lum = ((fg & 0x8) >> 3)*127;
- Genode::Color color(((fg & 0x4) >> 2)*127+lum, /* R+luminosity */
- ((fg & 0x2) >> 1)*127+lum, /* G+luminosity */
- (fg & 0x1)*127+lum /* B+luminosity */);
-
- Text_painter::paint(_surface, where, default_font, color, buffer);
-
- /* Checksum for comparing */
- if (fb_state.cmp_even) fb_state.checksum1 += character;
- else fb_state.checksum2 += character;
- }
- }
-
- fb_state.cmp_even = !fb_state.cmp_even;
-
- /* compare checksums to detect changed buffer */
- if (fb_state.checksum1 != fb_state.checksum2) {
- fb_state.unchanged = 0;
- _framebuffer.refresh(0, 0, _fb_mode.area.w(), _fb_mode.area.h());
- return 100;
- }
-
- if (++fb_state.unchanged < 10)
- return fb_state.unchanged * 30;
-
- /* if we copy the same data 10 times, unmap the text buffer from guest */
- _memory.detach(PHYS_FRAME_VGA_COLOR << 12,
- FRAME_COUNT_COLOR << 12);
-
- fb_state.vga_revoked = true;
- fb_state.unchanged = 0;
-
- _framebuffer.refresh(0, 0, _fb_mode.area.w(), _fb_mode.area.h());
- //Logging::printf("Deactivated text buffer loop.\n");
-
- return 0;
- }
-
- if (!fb_state.vga_revoked) {
- _memory.detach(PHYS_FRAME_VGA_COLOR << 12,
- FRAME_COUNT_COLOR << 12);
-
- fb_state.vga_revoked = true;
- }
-
- if (!fb_state.active) {
- fb_state.unchanged = 0;
- return 0;
- }
-
- _framebuffer.refresh(0, 0, _fb_mode.area.w(), _fb_mode.area.h());
-
- fb_state.unchanged++;
-
- return (fb_state.unchanged > 4) ? 4 * 10 : fb_state.unchanged * 10;
-}
-
-
-void Seoul::Console::_handle_input()
-{
- _input.for_each_event([&] (Input::Event const &ev) {
-
- if (!fb_state.active) {
- fb_state.active = true;
-
- MessageTimer msg(_timer, _motherboard()->clock()->abstime(1, 1000));
- _motherboard()->bus_timer.send(msg);
- }
-
- /* update mouse model (PS2) */
- if (mouse_event(ev)) {
- MessageInput msg(0x10001, _input_to_ps2mouse(ev), _input_to_ps2wheel(ev));
- _motherboard()->bus_input.send(msg);
- }
-
- ev.handle_press([&] (Input::Keycode key, Genode::Codepoint) {
- if (key <= 0xee)
- _vkeyb.handle_keycode_press(key); });
-
- ev.handle_release([&] (Input::Keycode key) {
- if (key <= 0xee)
- _vkeyb.handle_keycode_release(key); });
- });
-}
-
-
-void Seoul::Console::register_host_operations(Motherboard &motherboard)
-{
- motherboard.bus_console .add(this, receive_static);
- motherboard.bus_memregion.add(this, receive_static);
- motherboard.bus_timeout .add(this, receive_static);
-
- MessageTimer msg;
- if (!motherboard.bus_timer.send(msg))
- Logging::panic("%s can't get a timer", __PRETTY_FUNCTION__);
-
- _timer = msg.nr;
-}
-
-
-bool Seoul::Console::receive(MessageTimeout &msg) {
- if (msg.nr != _timer)
- return false;
-
- unsigned next_timeout_ms = _handle_fb();
-
- if (next_timeout_ms) {
- MessageTimer msg_t(_timer, _unsynchronized_motherboard.clock()->abstime(next_timeout_ms, 1000));
- _unsynchronized_motherboard.bus_timer.send(msg_t);
- }
-
- return true;
-}
-
-
-Seoul::Console::Console(Genode::Env &env, Genode::Allocator &alloc,
- Synced_motherboard &mb,
- Motherboard &unsynchronized_motherboard,
- Gui::Connection &gui,
- Seoul::Guest_memory &guest_memory)
-:
- _env(env),
- _unsynchronized_motherboard(unsynchronized_motherboard),
- _motherboard(mb),
- _framebuffer(*gui.framebuffer()),
- _input(*gui.input()),
- _memory(guest_memory),
- _fb_ds(_framebuffer.dataspace()),
- _fb_mode(_framebuffer.mode()),
- _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(_pixels), _fb_mode.area)
-{
- 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);
-}
diff --git a/repos/ports/src/app/seoul/console.h b/repos/ports/src/app/seoul/console.h
deleted file mode 100644
index 91080a0af9..0000000000
--- a/repos/ports/src/app/seoul/console.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * \brief Manager of all VM requested console functionality
- * \author Markus Partheymueller
- * \date 2012-07-31
- */
-
-/*
- * Copyright (C) 2012 Intel Corporation
- * Copyright (C) 2013-2017 Genode Labs GmbH
- *
- * 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.
- *
- * Modifications by Intel Corporation are contributed under the terms and
- * conditions of the GNU General Public License version 2.
- */
-
-#ifndef _CONSOLE_H_
-#define _CONSOLE_H_
-
-/* base includes */
-#include
-#include
-#include
-#include
-
-/* os includes */
-#include
-#include
-#include
-#include
-
-#include
-
-/* local includes */
-#include "keyboard.h"
-#include "synced_motherboard.h"
-#include "guest_memory.h"
-
-namespace Seoul {
- class Console;
- using Genode::Pixel_rgb888;
- using Genode::Dataspace_capability;
-}
-
-class Seoul::Console : public StaticReceiver
-{
- private:
-
- Genode::Env &_env;
- Motherboard &_unsynchronized_motherboard;
- Synced_motherboard &_motherboard;
- Framebuffer::Session &_framebuffer;
- Input::Session_client &_input;
- 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 _surface;
- unsigned _timer { 0 };
- Keyboard _vkeyb { _motherboard };
- char *_guest_fb { nullptr };
- VgaRegs *_regs { nullptr };
- bool _left { false };
- bool _middle { false };
- bool _right { false };
-
- unsigned _input_to_ps2mouse(Input::Event const &);
- unsigned _input_to_ps2wheel(Input::Event const &);
-
- Genode::Signal_handler _signal_input
- = { _env.ep(), *this, &Console::_handle_input };
-
- void _handle_input();
- unsigned _handle_fb();
-
- void _reactivate();
-
- /*
- * Noncopyable
- */
- Console(Console const &);
- Console &operator = (Console const &);
-
- 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 &);
- bool receive(MessageTimeout &);
-
- void register_host_operations(Motherboard &);
-
- /**
- * Constructor
- */
- Console(Genode::Env &env, Genode::Allocator &alloc,
- Synced_motherboard &, Motherboard &,
- Gui::Connection &, Seoul::Guest_memory &);
-};
-
-#endif /* _CONSOLE_H_ */
diff --git a/repos/ports/src/app/seoul/device_model_registry.cc b/repos/ports/src/app/seoul/device_model_registry.cc
deleted file mode 100644
index d37987ecd5..0000000000
--- a/repos/ports/src/app/seoul/device_model_registry.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * \brief Meta-data registry about the device models of Vancouver
- * \author Norman Feske
- * \author Markus Partheymueller
- * \date 2011-11-18
- */
-
-/*
- * Copyright (C) 2011-2017 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.
- *
- * Modifications by Intel Corporation are contributed under the terms and
- * conditions of the GNU General Public License version 2.
- */
-
-/* local includes */
-#include "device_model_registry.h"
-
-
-Device_model_registry *device_model_registry()
-{
- static Device_model_registry inst;
- return &inst;
-}
-
-
-Device_model_info::Device_model_info(char const *name, Create create,
- char const *arg_names[])
-:
- name(name), create(create), arg_names(arg_names)
-{
- device_model_registry()->insert(this);
-}
-
-
-/**
- * Helper macro to create global 'Device_model_info' objects
- */
-#define MODEL_INFO(name, ...) \
-extern "C" void __parameter_##name##_fn(Motherboard &, unsigned long *, \
- const char *, unsigned); \
-static char const * name##_arg_names[] = { __VA_ARGS__ , 0 }; \
-static Device_model_info \
- name##_model_info(#name, __parameter_##name##_fn, name##_arg_names);
-
-#define MODEL_INFO_NO_ARG(name) MODEL_INFO(name, 0)
-
-
-/*******************************
- ** Registry of device models **
- *******************************/
-
-/*
- * For each device model, a dedicated global 'Device_model_info' object is
- * created. At construction time, each 'Device_model_info' adds itself to
- * the 'Device_model_registry'.
- *
- * We supplement the device models with the information about their argument
- * names. This enables us to describe a virtual machine via a simple XML format
- * instead of using a special syntax.
- */
-
-MODEL_INFO(mem, "start", "end")
-MODEL_INFO(nullio, "io_base", "size")
-MODEL_INFO(pic, "io_base", "irq", "elcr_base")
-MODEL_INFO(pit, "io_base", "irq")
-MODEL_INFO(scp, "io_port_a", "io_port_b")
-MODEL_INFO(kbc, "io_base", "irq_kbd", "irq_aux")
-MODEL_INFO(keyb, "ps2_port", "host_keyboard")
-MODEL_INFO(mouse, "ps2_port", "host_mouse")
-MODEL_INFO(rtc, "io_base", "irq")
-MODEL_INFO(serial, "io_base", "irq", "host_serial")
-MODEL_INFO(pmtimer, "io_port")
-MODEL_INFO(vga, "io_base", "fb_size")
-MODEL_INFO(vga_fbsize, "fb_size")
-
-MODEL_INFO(pcihostbridge, "bus_num", "bus_count", "io_base", "mem_base")
-MODEL_INFO(intel82576vf, "promisc", "mem_mmio", "mem_msix", "txpoll_us", "rx_map")
-MODEL_INFO(rtl8029, "bdf", "irq", "port")
-
-MODEL_INFO(ide, "port0", "port1", "irq", "bdf", "disk")
-MODEL_INFO(ahci, "mem", "irq", "bdf")
-MODEL_INFO(drive, "sigma0drive", "controller", "port")
-
-MODEL_INFO(vbios_multiboot, "modaddr", "lowmem")
-
-MODEL_INFO_NO_ARG(vbios_disk)
-MODEL_INFO(vbios_keyboard, "host_keyboard")
-MODEL_INFO_NO_ARG(vbios_mem)
-MODEL_INFO_NO_ARG(vbios_time)
-MODEL_INFO_NO_ARG(vbios_reset)
-MODEL_INFO_NO_ARG(msi)
-MODEL_INFO_NO_ARG(ioapic)
-MODEL_INFO_NO_ARG(vcpu)
-MODEL_INFO_NO_ARG(halifax)
-MODEL_INFO_NO_ARG(vbios)
-MODEL_INFO_NO_ARG(lapic)
-
-MODEL_INFO(hostsink, "host_dev", "buffer")
diff --git a/repos/ports/src/app/seoul/device_model_registry.h b/repos/ports/src/app/seoul/device_model_registry.h
deleted file mode 100644
index dc4d9299e2..0000000000
--- a/repos/ports/src/app/seoul/device_model_registry.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * \brief Meta-data registry about the device models of Vancouver
- * \author Norman Feske
- * \date 2011-11-18
- */
-
-/*
- * Copyright (C) 2011-2017 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 _DEVICE_MODEL_REGISTRY_H_
-#define _DEVICE_MODEL_REGISTRY_H_
-
-/* Genode includes */
-#include
-#include
-
-/* NOVA userland includes */
-#include
-
-struct Device_model_info : Genode::List::Element
-{
- typedef void (*Create)(Motherboard &, unsigned long *argv,
- const char *args, unsigned args_len);
-
- /**
- * Name of device model
- */
- char const *name;
-
- /**
- * Function for creating a new device-model instance
- */
- Create create;
-
- /**
- * Argument names
- */
- char const **arg_names;
-
- Device_model_info(char const *name, Create create, char const *arg_names[]);
-};
-
-
-struct Device_model_registry : Genode::List
-{
- Device_model_info *lookup(char const *name)
- {
- for (Device_model_info *curr = first(); curr; curr = curr->next())
- if (Genode::strcmp(curr->name, name) == 0)
- return curr;
-
- return 0;
- }
-};
-
-
-/**
- * Return singleton instance of device model registry
- */
-Device_model_registry *device_model_registry();
-
-#endif /* _DEVICE_MODEL_REGISTRY_H_ */
diff --git a/repos/ports/src/app/seoul/disk.cc b/repos/ports/src/app/seoul/disk.cc
deleted file mode 100644
index 81f15f54d4..0000000000
--- a/repos/ports/src/app/seoul/disk.cc
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * \brief Block interface
- * \author Markus Partheymueller
- * \author Alexander Boettcher
- * \date 2012-09-15
- */
-
-/*
- * Copyright (C) 2012 Intel Corporation
- * Copyright (C) 2013-2018 Genode Labs GmbH
- *
- * 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.
- *
- * Modifications by Intel Corporation are contributed under the terms and
- * conditions of the GNU General Public License version 2.
- */
-
-/* Genode includes */
-#include
-#include
-#include
-
-/* local includes */
-#include "disk.h"
-
-static Genode::Heap * disk_heap(Genode::Ram_allocator *ram = nullptr,
- Genode::Region_map *rm = nullptr)
-{
- static Genode::Heap heap(ram, rm);
- return &heap;
-}
-static Genode::Heap * disk_heap_msg(Genode::Env &env)
-{
- static Genode::Heap heap(&env.ram(), &env.rm(), 4096);
- return &heap;
-}
-static Genode::Heap * disk_heap_avl(Genode::Env &env)
-{
- static Genode::Heap heap(&env.ram(), &env.rm(), 4096);
- return &heap;
-}
-
-
-Seoul::Disk::Disk(Genode::Env &env, Synced_motherboard &mb,
- char * backing_store_base, Genode::size_t backing_store_size)
-:
- _env(env),
- _motherboard(mb),
- _backing_store_base(backing_store_base),
- _backing_store_size(backing_store_size),
- _tslab_msg(disk_heap_msg(env)),
- _tslab_avl(disk_heap_avl(env))
-{
- /* initialize disk heap */
- disk_heap(&env.ram(), &env.rm());
-
- /* initialize struct with 0 size */
- for (int i=0; i < MAX_DISKS; i++) {
- _diskcon[i].info.block_size = 0;
- }
-}
-
-
-void Seoul::Disk::register_host_operations(Motherboard &motherboard)
-{
- motherboard.bus_disk.add(this, receive_static);
-}
-
-void Seoul::Disk_signal::_signal() { _obj.handle_disk(_id); }
-
-void Seoul::Disk::handle_disk(unsigned disknr)
-{
- Block::Session::Tx::Source *source = _diskcon[disknr].blk_con->tx();
-
- while (source->ack_avail())
- {
- Block::Packet_descriptor packet = source->get_acked_packet();
- char * const source_addr = source->packet_content(packet);
-
- /* find the corresponding MessageDisk object */
- Avl_entry * obj = lookup_and_remove(_lookup_msg, source_addr);
- if (!obj) {
- Genode::warning("unknown MessageDisk object - drop ack of block session ", (void *)source_addr);
- continue;
- }
- /* got the MessageDisk object */
- MessageDisk * msg = obj->msg();
- /* delete helper object */
- destroy(&_tslab_avl, obj);
-
- /* go ahead and tell VMM about new block event */
- if (!packet.succeeded() ||
- !(packet.operation() == Block::Packet_descriptor::Opcode::READ ||
- packet.operation() == Block::Packet_descriptor::Opcode::WRITE)) {
-
- Genode::warning("getting block failed");
-
- MessageDiskCommit mdc(disknr, msg->usertag,
- MessageDisk::DISK_STATUS_DEVICE);
- _motherboard()->bus_diskcommit.send(mdc);
-
- } else {
-
- if (packet.operation() == Block::Packet_descriptor::Opcode::READ) {
-
- unsigned long long sector = msg->sector;
- sector = (sector-packet.block_number())
- * _diskcon[disknr].info.block_size;
-
- bool const ok = check_dma_descriptors(msg,
- [&](char * const dma_addr, unsigned i)
- {
- size_t const bytecount = msg->dma[i].bytecount;
-
- if (bytecount > packet.size() ||
- sector > packet.size() ||
- sector + bytecount > packet.size() ||
- source_addr > source->packet_content(packet) + packet.size() - sector - bytecount ||
- _backing_store_base + _backing_store_size - bytecount < dma_addr)
- return false;
-
- memcpy(dma_addr, source_addr + sector, bytecount);
- sector += bytecount;
- return true;
- });
-
- if (!ok)
- Genode::warning("DMA bounds violation during read");
-
- destroy(disk_heap(), msg->dma);
- msg->dma = nullptr;
- }
-
- MessageDiskCommit mdc (disknr, msg->usertag, MessageDisk::DISK_OK);
- _motherboard()->bus_diskcommit.send(mdc);
- }
-
- {
- Genode::Mutex::Guard guard(_alloc_mutex);
- source->release_packet(packet);
- }
- destroy(&_tslab_msg, msg);
- }
-
- /* restart disk operations suspended due to out of memory by alloc_packet */
- check_restart();
-}
-
-
-bool Seoul::Disk::receive(MessageDisk &msg)
-{
- if (msg.disknr >= MAX_DISKS)
- Logging::panic("You configured more disks than supported.\n");
-
- struct disk_session &disk = _diskcon[msg.disknr];
-
- if (!disk.info.block_size) {
- Genode::String<16> label("VirtualDisk ", msg.disknr);
- /*
- * If we receive a message for this disk the first time, create the
- * structure for it.
- */
- try {
- Genode::Allocator_avl * block_alloc =
- new (disk_heap()) Genode::Allocator_avl(disk_heap());
-
- disk.blk_con =
- new (disk_heap()) Block::Connection<>(_env, block_alloc,
- 4*512*1024,
- label.string());
- disk.signal =
- new (disk_heap()) Seoul::Disk_signal(_env.ep(), *this,
- *disk.blk_con, msg.disknr);
- } catch (...) {
- /* there is none. */
- return false;
- }
-
- disk.info = disk.blk_con->info();
- }
-
- msg.error = MessageDisk::DISK_OK;
-
- switch (msg.type) {
- case MessageDisk::DISK_GET_PARAMS:
- {
- Genode::String<16> label("VirtualDisk ", msg.disknr);
-
- msg.params->flags = DiskParameter::FLAG_HARDDISK;
- msg.params->sectors = disk.info.block_count;
- msg.params->sectorsize = disk.info.block_size;
- msg.params->maxrequestcount = disk.info.block_count;
- memcpy(msg.params->name, label.string(), label.length());
-
- return true;
- }
- case MessageDisk::DISK_WRITE:
- /* don't write on read only medium */
- if (!disk.info.writeable) {
- MessageDiskCommit ro(msg.disknr, msg.usertag,
- MessageDisk::DISK_STATUS_DEVICE);
- _motherboard()->bus_diskcommit.send(ro);
- return true;
- }
-
- [[fallthrough]];
-
- case MessageDisk::DISK_READ:
- /* read and write handling */
- return execute(msg.type == MessageDisk::DISK_WRITE, disk, msg);
- default:
- Logging::printf("Got MessageDisk type %x\n", msg.type);
- return false;
- }
-}
-
-void Seoul::Disk::check_restart()
-{
- bool restarted = true;
-
- while (restarted) {
- Avl_entry * obj = lookup_and_remove(_restart_msg);
- if (!obj)
- return;
-
- MessageDisk * const msg = obj->msg();
- struct disk_session const &disk = _diskcon[msg->disknr];
-
- restarted = restart(disk, msg);
-
- if (restarted) {
- destroy(&_tslab_avl, obj);
- } else {
- Genode::Mutex::Guard guard(_alloc_mutex);
- _restart_msg.insert(obj);
- }
- }
-}
-
-bool Seoul::Disk::restart(struct disk_session const &disk,
- MessageDisk * const msg)
-{
- Block::Session::Tx::Source * const source = disk.blk_con->tx();
-
- unsigned long const total = DmaDescriptor::sum_length(msg->dmacount, msg->dma);
- unsigned long const blk_size = disk.info.block_size;
- unsigned long const blocks = total/blk_size + ((total%blk_size) ? 1 : 0);
- bool const write = msg->type == MessageDisk::DISK_WRITE;
-
- Block::Packet_descriptor packet;
-
- try {
- Genode::Mutex::Guard guard(_alloc_mutex);
-
- packet = Block::Packet_descriptor(
- disk.blk_con->alloc_packet(blocks * blk_size),
- (write) ? Block::Packet_descriptor::WRITE
- : Block::Packet_descriptor::READ,
- msg->sector, blocks);
-
- char * source_addr = source->packet_content(packet);
- _lookup_msg.insert(new (&_tslab_avl) Avl_entry(source_addr, msg));
-
- } catch (...) { return false; }
-
- /* read */
- if (!write) {
- source->submit_packet(packet);
- return true;
- }
-
- /* write */
- char * source_addr = source->packet_content(packet);
- source_addr += (msg->sector - packet.block_number()) * blk_size;
-
- for (unsigned i = 0; i < msg->dmacount; i++) {
- char * const dma_addr = _backing_store_base +
- msg->dma[i].byteoffset +
- msg->physoffset;
-
- memcpy(source_addr, dma_addr, msg->dma[i].bytecount);
- source_addr += msg->dma[i].bytecount;
- }
-
- /* free up DMA descriptors of write */
- destroy(disk_heap(), msg->dma);
- msg->dma = nullptr;
-
- source->submit_packet(packet);
- return true;
-}
-
-
-bool Seoul::Disk::execute(bool const write, struct disk_session const &disk,
- MessageDisk const &msg)
-{
- unsigned long long const sector = msg.sector;
- unsigned long const total = DmaDescriptor::sum_length(msg.dmacount, msg.dma);
- unsigned long const blk_size = disk.info.block_size;
- unsigned long const blocks = total/blk_size + ((total%blk_size) ? 1 : 0);
-
- Block::Session::Tx::Source * const source = disk.blk_con->tx();
- Block::Packet_descriptor packet;
-
- /* msg copy required for acknowledgements */
- MessageDisk * const msg_cpy = new (&_tslab_msg) MessageDisk(msg);
- char * source_addr = nullptr;
-
- try {
- Genode::Mutex::Guard guard(_alloc_mutex);
-
- packet = Block::Packet_descriptor(
- disk.blk_con->alloc_packet(blocks * blk_size),
- (write) ? Block::Packet_descriptor::WRITE
- : Block::Packet_descriptor::READ,
- sector, blocks);
-
- source_addr = source->packet_content(packet);
-
- _lookup_msg.insert(new (&_tslab_avl) Avl_entry(source_addr, msg_cpy));
- } catch (Block::Session::Tx::Source::Packet_alloc_failed) {
- /* msg_cpy object will be used/freed below by copy_dma_descriptors */
- } catch (...) {
- if (msg_cpy)
- destroy(&_tslab_msg, msg_cpy);
-
- Logging::printf("could not allocate disk block elements - "
- "write=%u blocks=%lu\n", write, blocks);
- return false;
- }
-
- /*
- * Copy DMA descriptors ever for read requests and for deferred write
- * requests. The descriptors can be changed by the guest at any time.
- */
- bool const copy_dma_descriptors = !source_addr || !write;
-
- /* invalid packet allocation or read request */
- if (copy_dma_descriptors) {
- msg_cpy->dma = new (disk_heap()) DmaDescriptor[msg_cpy->dmacount];
- for (unsigned i = 0; i < msg_cpy->dmacount; i++)
- memcpy(msg_cpy->dma + i, msg.dma + i, sizeof(DmaDescriptor));
-
- /* validate DMA descriptors */
- bool const ok = check_dma_descriptors(msg_cpy,
- [&](char * const dma_addr, unsigned i)
- {
- if (!write)
- /* evaluated during receive */
- return true;
-
- size_t const bytecount = msg_cpy->dma[i].bytecount;
-
- if (bytecount > packet.size() ||
- source_addr > source->packet_content(packet) + packet.size() - bytecount ||
- _backing_store_base + _backing_store_size - bytecount < dma_addr)
- return false;
-
- return true;
- });
-
- if (ok) {
- /* DMA descriptors look good - go ahead with disk request */
-
- if (source_addr)
- /* valid packet for read request */
- source->submit_packet(packet);
- else {
- /* failed packet allocation, restart at later point in time */
- Genode::Mutex::Guard guard(_alloc_mutex);
- _restart_msg.insert(new (&_tslab_avl) Avl_entry(source_addr,
- msg_cpy));
- }
- return true;
- }
-
- /* DMA descriptors look bad - free resources */
- destroy(disk_heap(), msg_cpy->dma);
- destroy(&_tslab_msg, msg_cpy);
- if (source_addr) {
- Genode::Mutex::Guard guard(_alloc_mutex);
- source->release_packet(packet);
- }
- return false;
- }
-
- /* valid packet allocation for write request */
- source_addr += (sector - packet.block_number()) * blk_size;
-
- bool const ok = check_dma_descriptors(msg_cpy,
- [&](char * const dma_addr, unsigned i)
- {
- /* read bytecount from guest memory once and don't evaluate again */
- size_t const bytecount = msg.dma[i].bytecount;
-
- if (bytecount > packet.size() ||
- source_addr > source->packet_content(packet) + packet.size() - bytecount ||
- _backing_store_base + _backing_store_size - bytecount < dma_addr)
- return false;
-
- memcpy(source_addr, dma_addr, bytecount);
- source_addr += bytecount;
-
- return true;
- });
-
- if (ok) {
- /* don't needed anymore + protect us to use it again */
- msg_cpy->dma = nullptr;
- source->submit_packet(packet);
- } else {
- destroy(&_tslab_msg, msg_cpy);
-
- Genode::Mutex::Guard guard(_alloc_mutex);
- source->release_packet(packet);
- }
- return ok;
-}
diff --git a/repos/ports/src/app/seoul/disk.h b/repos/ports/src/app/seoul/disk.h
deleted file mode 100644
index b35e6376fb..0000000000
--- a/repos/ports/src/app/seoul/disk.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * \brief Block interface
- * \author Markus Partheymueller
- * \author Alexander Boettcher
- * \date 2012-09-15
- */
-
-/*
- * Copyright (C) 2012 Intel Corporation
- * Copyright (C) 2013-2017 Genode Labs GmbH
- *
- * 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.
- *
- * Modifications by Intel Corporation are contributed under the terms and
- * conditions of the GNU General Public License version 2.
- */
-
-#ifndef _DISK_H_
-#define _DISK_H_
-
-/* Genode includes */
-#include
-#include
-#include
-#include
-
-/* local includes */
-#include "synced_motherboard.h"
-
-/* Seoul includes */
-#include
-
-namespace Seoul {
- class Disk;
- class Disk_signal;
-}
-
-class Seoul::Disk_signal
-{
- private:
-
- Disk &_obj;
- unsigned _id;
-
- void _signal();
-
- public:
-
- Genode::Signal_handler const sigh;
-
- Disk_signal(Genode::Entrypoint &ep, Disk &obj,
- Block::Connection<> &block, unsigned disk_nr)
- :
- _obj(obj), _id(disk_nr),
- sigh(ep, *this, &Disk_signal::_signal)
- {
- block.tx_channel()->sigh_ack_avail(sigh);
- block.tx_channel()->sigh_ready_to_submit(sigh);
- }
-};
-
-
-class Seoul::Disk : public StaticReceiver
-{
- private:
-
- Genode::Env &_env;
-
- /* helper class to lookup a MessageDisk object */
- class Avl_entry : public Genode::Avl_node
- {
-
- private:
-
- Genode::addr_t const _key;
- MessageDisk * const _msg;
-
- /*
- * Noncopyable
- */
- Avl_entry(Avl_entry const &);
- Avl_entry &operator = (Avl_entry const &);
-
- public:
-
- Avl_entry(void * key, MessageDisk * const msg)
- : _key(reinterpret_cast(key)), _msg(msg) { }
-
- bool higher(Avl_entry *e) const { return e->_key > _key; }
-
- Avl_entry *find(Genode::addr_t ptr)
- {
- if (ptr == _key) return this;
- Avl_entry *obj = this->child(ptr > _key);
- return obj ? obj->find(ptr) : 0;
- }
-
- MessageDisk * msg() { return _msg; }
- };
-
- /* block session used by disk models of VMM */
- enum { MAX_DISKS = 4 };
- struct disk_session {
- Block::Connection<> *blk_con;
- Block::Session::Info info;
- Disk_signal *signal;
- } _diskcon[MAX_DISKS] { };
-
- Synced_motherboard &_motherboard;
- char * const _backing_store_base;
- size_t const _backing_store_size;
-
- /* slabs for temporary holding MessageDisk objects */
- typedef Genode::Tslab MessageDisk_Slab;
- typedef Genode::Synced_allocator MessageDisk_Slab_Sync;
-
- MessageDisk_Slab_Sync _tslab_msg;
-
- /* Structure to find back the MessageDisk object out of a Block Ack */
- typedef Genode::Tslab Avl_entry_slab;
- typedef Genode::Synced_allocator Avl_entry_slab_sync;
-
- Avl_entry_slab_sync _tslab_avl;
-
- Genode::Avl_tree _lookup_msg { };
- Genode::Avl_tree _restart_msg { };
- /* _alloc_mutex protects both lists + alloc_packet/release_packet !!! */
- Genode::Mutex _alloc_mutex { };
-
- /*
- * Noncopyable
- */
- Disk(Disk const &);
- Disk &operator = (Disk const &);
-
- void check_restart();
- bool restart(struct disk_session const &, MessageDisk * const);
- bool execute(bool const write, struct disk_session const &,
- MessageDisk const &);
-
- template
- bool check_dma_descriptors(MessageDisk const * const msg,
- FN const &fn)
- {
- /* check bounds for read and write operations */
- for (unsigned i = 0; i < msg->dmacount; i++) {
- char * const dma_addr = _backing_store_base +
- msg->dma[i].byteoffset +
- msg->physoffset;
-
- /* check for bounds */
- if (dma_addr >= _backing_store_base + _backing_store_size ||
- dma_addr < _backing_store_base)
- return false;
-
- if (!fn(dma_addr, i))
- return false;
- }
- return true;
- }
-
- /* find the corresponding MessageDisk object */
- Avl_entry * lookup_and_remove(Genode::Avl_tree &tree,
- void * specific_obj = nullptr)
- {
- Genode::Mutex::Guard guard(_alloc_mutex);
-
- Avl_entry * obj = tree.first();
- if (obj && specific_obj)
- obj = obj->find(reinterpret_cast(specific_obj));
-
- if (obj)
- tree.remove(obj);
-
- return obj;
- }
-
- public:
-
- /**
- * Constructor
- */
- Disk(Genode::Env &, Synced_motherboard &, char * backing_store_base,
- Genode::size_t backing_store_size);
-
- void handle_disk(unsigned);
-
- bool receive(MessageDisk &msg);
-
- void register_host_operations(Motherboard &);
-};
-
-#endif /* _DISK_H_ */
diff --git a/repos/ports/src/app/seoul/guest_memory.h b/repos/ports/src/app/seoul/guest_memory.h
deleted file mode 100644
index db611d7d80..0000000000
--- a/repos/ports/src/app/seoul/guest_memory.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * \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
-#include
-#include
-
-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::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 _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(_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_ */
diff --git a/repos/ports/src/app/seoul/include/service/memory.h b/repos/ports/src/app/seoul/include/service/memory.h
deleted file mode 100644
index 9cabf11f8d..0000000000
--- a/repos/ports/src/app/seoul/include/service/memory.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * \brief Memory header expected by Seoul
- * \author Markus Partheymueller
- * \date 2013-03-02
- */
-
-/*
- * Copyright (C) 2011-2017 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.
- */
-
-struct Aligned {
- size_t alignment;
- Aligned(size_t alignment) : alignment(alignment) {}
-};
-
-void *operator new[](size_t size);
-
-void *operator new[](size_t size, Aligned const alignment);
-
-void *operator new (size_t size);
-
-void operator delete[](void *ptr);
diff --git a/repos/ports/src/app/seoul/include/service/profile.h b/repos/ports/src/app/seoul/include/service/profile.h
deleted file mode 100644
index 86d067825d..0000000000
--- a/repos/ports/src/app/seoul/include/service/profile.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * \brief Disable original profiling macros of the NOVA userland
- * \author Norman Feske
- * \date 2011-11-19
- *
- * This header has the sole purpose to shadow the orignal 'service/profile.h'
- * header of the NOVA userland. The original macros rely on special support in
- * the linker script. However, we prefer to stick with Genode's generic linker
- * script.
- */
-
-/*
- * Copyright (C) 2011-2017 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.
- */
-
-#pragma once
-
-#define COUNTER_INC(NAME)
-#define COUNTER_SET(NAME, VALUE)
diff --git a/repos/ports/src/app/seoul/keyboard.cc b/repos/ports/src/app/seoul/keyboard.cc
deleted file mode 100644
index 7a17aaaad5..0000000000
--- a/repos/ports/src/app/seoul/keyboard.cc
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * \brief Keyboard manager
- * \author Markus Partheymueller
- * \date 2012-07-31
- */
-
-/*
- * Copyright (C) 2012 Intel Corporation
- * Copyright (C) 2013-2017 Genode Labs GmbH
- *
- * 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.
- *
- * Modifications by Intel Corporation are contributed under the terms and
- * conditions of the GNU General Public License version 2.
- */
-
-/* local includes */
-#include "keyboard.h"
-
-/* vancouver generic keyboard helper */
-#include
-#include
-
-
-Seoul::Keyboard::Keyboard(Synced_motherboard &mb)
-: _motherboard(mb), _flags(0) { }
-
-
-bool Seoul::Keyboard::_map_keycode(unsigned &keycode, bool press)
-{
- switch (keycode) {
-
- /* modifiers */
- case Input::KEY_LEFTSHIFT: _flags |= KBFLAG_LSHIFT; keycode = 0x12; break;
- case Input::KEY_RIGHTSHIFT: _flags |= KBFLAG_RSHIFT; keycode = 0x59; break;
- case Input::KEY_LEFTALT: _flags |= KBFLAG_LALT; keycode = 0x11; break;
- case Input::KEY_RIGHTALT: _flags |= KBFLAG_RALT; keycode = 0x11; break;
- case Input::KEY_LEFTCTRL: _flags |= KBFLAG_LCTRL; keycode = 0x14; break;
- case Input::KEY_RIGHTCTRL: _flags |= KBFLAG_RCTRL; keycode = 0x14; break;
- case Input::KEY_LEFTMETA: _flags |= KBFLAG_LWIN; keycode = 0x1f;
- if (press) return false;
- break;
- case Input::KEY_RIGHTMETA: _flags |= KBFLAG_RWIN; keycode = 0x27;
- if (press) return false;
- break;
- case Input::KEY_KPSLASH: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x35); break;
- case Input::KEY_KPENTER: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x1c); break;
- case Input::KEY_F11: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x57); break;
- case Input::KEY_F12: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x58); break;
- case Input::KEY_INSERT: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x52); break;
- case Input::KEY_DELETE: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x53); break;
- case Input::KEY_HOME: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x47); break;
- case Input::KEY_END: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x4f); break;
- case Input::KEY_PAGEUP: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x49); break;
- case Input::KEY_PAGEDOWN: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x51); break;
- case Input::KEY_LEFT: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x4b); break;
- case Input::KEY_RIGHT: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x4d); break;
- case Input::KEY_UP: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x48); break;
- case Input::KEY_DOWN: _flags |= KBFLAG_EXTEND0;
- keycode = GenericKeyboard::translate_sc1_to_sc2(0x50); break;
-
- /* up to 0x53, the Genode key codes correspond to scan code set 1 */
- default:
- if (keycode <= 0x53) {
- keycode = GenericKeyboard::translate_sc1_to_sc2(keycode);
- break;
- } else return false;
- }
-
- return true;
-}
-
-
-void Seoul::Keyboard::handle_keycode_press(unsigned keycode)
-{
- unsigned orig_keycode = keycode;
-
- if (!_map_keycode(keycode, true))
- return;
-
- MessageInput msg(0x10000, _flags | keycode);
-
- /* debug */
- if ((_flags & KBFLAG_LWIN) && orig_keycode == Input::KEY_INSERT) {
- Logging::printf("DEBUG key\n");
-
- /* we send an empty event */
- CpuEvent msg(VCpu::EVENT_DEBUG);
- for (VCpu *vcpu = _motherboard()->last_vcpu; vcpu; vcpu=vcpu->get_last())
- vcpu->bus_event.send(msg);
- }
-
- /* reset */
- else if ((_flags & KBFLAG_LWIN) && orig_keycode == Input::KEY_END) {
- Logging::printf("Reset VM\n");
- MessageLegacy msg2(MessageLegacy::RESET, 0);
- _motherboard()->bus_legacy.send_fifo(msg2);
- }
-
- else _motherboard()->bus_input.send(msg);
-
- _flags &= ~(KBFLAG_EXTEND0 | KBFLAG_RELEASE | KBFLAG_EXTEND1);
-}
-
-
-void Seoul::Keyboard::handle_keycode_release(unsigned keycode)
-{
- _flags |= KBFLAG_RELEASE;
-
- if (!_map_keycode(keycode, false))
- return;
-
- MessageInput msg(0x10000, _flags | keycode);
- _motherboard()->bus_input.send(msg);
-
- _flags &= ~(KBFLAG_EXTEND0 | KBFLAG_RELEASE | KBFLAG_EXTEND1);
-}
diff --git a/repos/ports/src/app/seoul/keyboard.h b/repos/ports/src/app/seoul/keyboard.h
deleted file mode 100644
index 963abcc7da..0000000000
--- a/repos/ports/src/app/seoul/keyboard.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * \brief Keyboard manager
- * \author Markus Partheymueller
- * \date 2012-07-31
- */
-
-/*
- * Copyright (C) 2012 Intel Corporation
- * Copyright (C) 2013-2017 Genode Labs GmbH
- *
- * 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.
- *
- * Modifications by Intel Corporation are contributed under the terms and
- * conditions of the GNU General Public License version 2.
- */
-
-#ifndef _KEYBOARD_H_
-#define _KEYBOARD_H_
-
-
-/* includes for I/O */
-#include
-#include
-#include
-
-/* local includes */
-#include "synced_motherboard.h"
-
-namespace Seoul {
- class Keyboard;
-}
-
-class Seoul::Keyboard
-{
- private:
-
- Synced_motherboard &_motherboard;
- unsigned _flags;
-
- bool _map_keycode(unsigned &, bool);
-
- public:
-
- /**
- * Constructor
- */
- Keyboard(Synced_motherboard &);
-
- void handle_keycode_press(unsigned keycode);
- void handle_keycode_release(unsigned keycode);
-};
-
-#endif /* _KEYBOARD_H_ */
diff --git a/repos/ports/src/app/seoul/mono.tff b/repos/ports/src/app/seoul/mono.tff
deleted file mode 120000
index 6d15849687..0000000000
--- a/repos/ports/src/app/seoul/mono.tff
+++ /dev/null
@@ -1 +0,0 @@
-../../../../demo/src/server/nitlog/mono.tff
\ No newline at end of file
diff --git a/repos/ports/src/app/seoul/network.cc b/repos/ports/src/app/seoul/network.cc
deleted file mode 100644
index 76e159a5c8..0000000000
--- a/repos/ports/src/app/seoul/network.cc
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * \brief Network receive handler per MAC address
- * \author Markus Partheymueller
- * \author Alexander Boettcher
- * \date 2012-07-31
- */
-
-/*
- * Copyright (C) 2012 Intel Corporation
- * Copyright (C) 2013-2017 Genode Labs GmbH
- *
- * 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.
- *
- * Modifications by Intel Corporation are contributed under the terms and
- * conditions of the GNU General Public License version 2.
- */
-
-/* local includes */
-#include "network.h"
-
-
-Seoul::Network::Network(Genode::Env &env, Genode::Heap &heap,
- Synced_motherboard &mb)
-:
- _motherboard(mb), _tx_block_alloc(&heap),
- _nic(env, &_tx_block_alloc, BUF_SIZE, BUF_SIZE),
- _packet_avail(env.ep(), *this, &Network::_handle_packets)
-{
- _nic.rx_channel()->sigh_packet_avail(_packet_avail);
-}
-
-
-void Seoul::Network::_handle_packets()
-{
- while (_nic.rx()->packet_avail()) {
-
- Nic::Packet_descriptor rx_packet = _nic.rx()->get_packet();
-
- /* send it to the network bus */
- char * rx_content = _nic.rx()->packet_content(rx_packet);
- _forward_pkt = rx_content;
- MessageNetwork msg((unsigned char *)rx_content, rx_packet.size(), 0);
- _motherboard()->bus_network.send(msg);
- _forward_pkt = 0;
-
- /* acknowledge received packet */
- if (!_nic.rx()->ready_to_ack())
- Logging::printf("not ready for acks");
-
- _nic.rx()->acknowledge_packet(rx_packet);
- }
-}
-
-
-bool Seoul::Network::transmit(void const * const packet, Genode::size_t len)
-{
- if (packet == _forward_pkt)
- /* don't end in an endless forwarding loop */
- return false;
-
- /* check for acknowledgements */
- while (_nic.tx()->ack_avail()) {
- Nic::Packet_descriptor const ack = _nic.tx()->get_acked_packet();
- _nic.tx()->release_packet(ack);
- }
-
- /* allocate transmit packet */
- Nic::Packet_descriptor tx_packet;
- try {
- tx_packet = _nic.tx()->alloc_packet(len);
- } catch (Nic::Session::Tx::Source::Packet_alloc_failed) {
- Logging::printf("error: tx packet alloc failed\n");
- return false;
- }
-
- /* fill packet with content */
- char * const tx_content = _nic.tx()->packet_content(tx_packet);
- memcpy(tx_content, packet, len);
-
- _nic.tx()->submit_packet(tx_packet);
-
- return true;
-}
diff --git a/repos/ports/src/app/seoul/network.h b/repos/ports/src/app/seoul/network.h
deleted file mode 100644
index 13bdd3386e..0000000000
--- a/repos/ports/src/app/seoul/network.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * \brief Network receive handler per MAC address
- * \author Markus Partheymueller
- * \author Alexander Boettcher
- * \date 2012-07-31
- */
-
-/*
- * Copyright (C) 2012 Intel Corporation
- * Copyright (C) 2013-2017 Genode Labs GmbH
- *
- * 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.
- *
- * Modifications by Intel Corporation are contributed under the terms and
- * conditions of the GNU General Public License version 2.
- */
-
-#ifndef _NETWORK_H_
-#define _NETWORK_H_
-
-/* base includes */
-#include
-
-/* os includes */
-#include
-#include
-
-/* local includes */
-#include "synced_motherboard.h"
-
-namespace Seoul {
- class Network;
-}
-
-class Seoul::Network
-{
- private:
-
- enum {
- PACKET_SIZE = Nic::Packet_allocator::DEFAULT_PACKET_SIZE,
- BUF_SIZE = Nic::Session::QUEUE_SIZE * PACKET_SIZE,
- };
-
- Synced_motherboard &_motherboard;
- Nic::Packet_allocator _tx_block_alloc;
- Nic::Connection _nic;
-
- Genode::Signal_handler const _packet_avail;
- void const * _forward_pkt = nullptr;
-
- void _handle_packets();
-
- /*
- * Noncopyable
- */
- Network(Network const &);
- Network &operator = (Network const &);
-
- public:
-
- Network(Genode::Env &, Genode::Heap &, Synced_motherboard &);
-
- Nic::Mac_address mac_address() { return _nic.mac_address(); }
-
- bool transmit(void const * const packet, Genode::size_t len);
-};
-
-#endif /* _NETWORK_H_ */
diff --git a/repos/ports/src/app/seoul/state.cc b/repos/ports/src/app/seoul/state.cc
deleted file mode 100644
index 7db50d45e6..0000000000
--- a/repos/ports/src/app/seoul/state.cc
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * \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
-
-#include "state.h"
-
-void Seoul::write_vm_state(CpuState &seoul, unsigned mtr, Genode::Vcpu_state &state)
-{
- state.discharge(); /* reset */
-
- if (mtr & MTD_GPR_ACDB) {
- state.ax.charge(seoul.rax);
- state.cx.charge(seoul.rcx);
- state.dx.charge(seoul.rdx);
- state.bx.charge(seoul.rbx);
- mtr &= ~MTD_GPR_ACDB;
- }
-
- if (mtr & MTD_GPR_BSD) {
- state.di.charge(seoul.rdix);
- state.si.charge(seoul.rsix);
- state.bp.charge(seoul.rbpx);
- mtr &= ~MTD_GPR_BSD;
- }
-
- if (mtr & MTD_RIP_LEN) {
- state.ip.charge(seoul.ripx);
- state.ip_len.charge(seoul.inst_len);
- mtr &= ~MTD_RIP_LEN;
- }
-
- if (mtr & MTD_RSP) {
- state.sp.charge(seoul.rspx);
- mtr &= ~MTD_RSP;
- }
-
- if (mtr & MTD_RFLAGS) {
- state.flags.charge(seoul.rflx);
- mtr &= ~MTD_RFLAGS;
- }
-
- if (mtr & MTD_DR) {
- state.dr7.charge(seoul.dr7);
- mtr &= ~MTD_DR;
- }
-
- if (mtr & MTD_CR) {
- state.cr0.charge(seoul.cr0);
- state.cr2.charge(seoul.cr2);
- state.cr3.charge(seoul.cr3);
- state.cr4.charge(seoul.cr4);
- mtr &= ~MTD_CR;
- }
-
- typedef Genode::Vcpu_state::Segment Segment;
- typedef Genode::Vcpu_state::Range Range;
-
- if (mtr & MTD_CS_SS) {
- state.cs.charge(Segment { .sel = seoul.cs.sel,
- .ar = seoul.cs.ar,
- .limit = seoul.cs.limit,
- .base = seoul.cs.base });
- state.ss.charge(Segment { .sel = seoul.ss.sel,
- .ar = seoul.ss.ar,
- .limit = seoul.ss.limit,
- .base = seoul.ss.base });
- mtr &= ~MTD_CS_SS;
- }
-
- if (mtr & MTD_DS_ES) {
- state.es.charge(Segment { .sel = seoul.es.sel,
- .ar = seoul.es.ar,
- .limit = seoul.es.limit,
- .base = seoul.es.base });
- state.ds.charge(Segment { .sel = seoul.ds.sel,
- .ar = seoul.ds.ar,
- .limit = seoul.ds.limit,
- .base = seoul.ds.base });
- mtr &= ~MTD_DS_ES;
- }
-
- if (mtr & MTD_FS_GS) {
- state.fs.charge(Segment { .sel = seoul.fs.sel,
- .ar = seoul.fs.ar,
- .limit = seoul.fs.limit,
- .base = seoul.fs.base });
- state.gs.charge(Segment { .sel = seoul.gs.sel,
- .ar = seoul.gs.ar,
- .limit = seoul.gs.limit,
- .base = seoul.gs.base });
- mtr &= ~MTD_FS_GS;
- }
-
- if (mtr & MTD_TR) {
- state.tr.charge(Segment { .sel = seoul.tr.sel,
- .ar = seoul.tr.ar,
- .limit = seoul.tr.limit,
- .base = seoul.tr.base });
- mtr &= ~MTD_TR;
- }
-
- if (mtr & MTD_LDTR) {
- state.ldtr.charge(Segment { .sel = seoul.ld.sel,
- .ar = seoul.ld.ar,
- .limit = seoul.ld.limit,
- .base = seoul.ld.base });
- mtr &= ~MTD_LDTR;
- }
-
- if (mtr & MTD_GDTR) {
- state.gdtr.charge(Range { .limit = seoul.gd.limit,
- .base = seoul.gd.base });
- mtr &= ~MTD_GDTR;
- }
-
- if (mtr & MTD_IDTR) {
- state.idtr.charge(Range{ .limit = seoul.id.limit,
- .base = seoul.id.base });
- mtr &= ~MTD_IDTR;
- }
-
- if (mtr & MTD_SYSENTER) {
- state.sysenter_cs.charge(seoul.sysenter_cs);
- state.sysenter_sp.charge(seoul.sysenter_esp);
- state.sysenter_ip.charge(seoul.sysenter_eip);
- mtr &= ~MTD_SYSENTER;
- }
-
- if (mtr & MTD_QUAL) {
- state.qual_primary.charge(seoul.qual[0]);
- state.qual_secondary.charge(seoul.qual[1]);
- /* not read by any kernel */
- mtr &= ~MTD_QUAL;
- }
-
- if (mtr & MTD_CTRL) {
- state.ctrl_primary.charge(seoul.ctrl[0]);
- state.ctrl_secondary.charge(seoul.ctrl[1]);
- mtr &= ~MTD_CTRL;
- }
-
- if (mtr & MTD_INJ) {
- state.inj_info.charge(seoul.inj_info);
- state.inj_error.charge(seoul.inj_error);
- mtr &= ~MTD_INJ;
- }
-
- if (mtr & MTD_STATE) {
- state.intr_state.charge(seoul.intr_state);
- state.actv_state.charge(seoul.actv_state);
- mtr &= ~MTD_STATE;
- }
-
- if (mtr & MTD_TSC) {
- state.tsc.charge(seoul.tsc_value);
- state.tsc_offset.charge(seoul.tsc_off);
- mtr &= ~MTD_TSC;
- }
-
- if (mtr)
- Genode::error("state transfer incomplete ", Genode::Hex(mtr));
-}
-
-unsigned Seoul::read_vm_state(Genode::Vcpu_state &state, CpuState &seoul)
-{
- unsigned mtr = 0;
-
- if (state.ax.charged() || state.cx.charged() ||
- state.dx.charged() || state.bx.charged()) {
-
- if (!state.ax.charged() || !state.cx.charged() ||
- !state.dx.charged() || !state.bx.charged())
- 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.charged() || state.di.charged() || state.si.charged()) {
-
- if (!state.bp.charged() || !state.di.charged() || !state.si.charged())
- 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.charged()) {
- mtr |= MTD_RFLAGS;
- seoul.rflx = state.flags.value();
- }
-
- if (state.sp.charged()) {
- mtr |= MTD_RSP;
- seoul.rspx = state.sp.value();
- }
-
- if (state.ip.charged() || state.ip_len.charged()) {
- if (!state.ip.charged() || !state.ip_len.charged())
- Genode::warning("missing state ", __LINE__);
-
- mtr |= MTD_RIP_LEN;
- seoul.ripx = state.ip.value();
- seoul.inst_len = state.ip_len.value();
- }
-
- if (state.dr7.charged()) {
- mtr |= MTD_DR;
- seoul.dr7 = state.dr7.value();
- }
-#if 0
- if (state.r8.charged() || state.r9.charged() ||
- state.r10.charged() || state.r11.charged() ||
- state.r12.charged() || state.r13.charged() ||
- state.r14.charged() || state.r15.charged()) {
-
- Genode::warning("r8-r15 not supported");
- }
-#endif
-
- if (state.cr0.charged() || state.cr2.charged() ||
- state.cr3.charged() || state.cr4.charged()) {
-
- 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.charged() || state.ss.charged()) {
- if (!state.cs.charged() || !state.ss.charged())
- 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.charged() || state.ds.charged()) {
- if (!state.es.charged() || !state.ds.charged())
- 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.charged() || state.gs.charged()) {
- if (!state.fs.charged() || !state.gs.charged())
- 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.charged()) {
- 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.charged()) {
- 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.charged()) {
- mtr |= MTD_GDTR;
- seoul.gd.limit = state.gdtr.value().limit;
- seoul.gd.base = state.gdtr.value().base;
- }
-
- if (state.idtr.charged()) {
- mtr |= MTD_IDTR;
- seoul.id.limit = state.idtr.value().limit;
- seoul.id.base = state.idtr.value().base;
- }
-
- if (state.sysenter_cs.charged() || state.sysenter_sp.charged() ||
- state.sysenter_ip.charged()) {
-
- if (!state.sysenter_cs.charged() || !state.sysenter_sp.charged() ||
- !state.sysenter_ip.charged())
- 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.charged() || state.ctrl_secondary.charged()) {
- if (!state.ctrl_primary.charged() || !state.ctrl_secondary.charged())
- 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.charged() || state.inj_error.charged()) {
- if (!state.inj_info.charged() || !state.inj_error.charged())
- 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.charged() || state.actv_state.charged()) {
- if (!state.intr_state.charged() || !state.actv_state.charged())
- 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.charged() || state.tsc_offset.charged()) {
- if (!state.tsc.charged() || !state.tsc_offset.charged())
- 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.charged() || state.qual_secondary.charged()) {
- if (!state.qual_primary.charged() || !state.qual_secondary.charged())
- 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.charged()) {
- Genode::warning("efer not supported by Seoul");
- }
-
- if (state.pdpte_0.charged() || state.pdpte_1.charged() ||
- state.pdpte_2.charged() || state.pdpte_3.charged()) {
-
- Genode::warning("pdpte not supported by Seoul");
- }
-
- if (state.star.charged() || state.lstar.charged() || state.cstar.charged() ||
- state.fmask.charged() || state.kernel_gs_base.charged()) {
-
- Genode::warning("star, lstar, cstar, fmask, kernel_gs not supported by Seoul");
- }
-
- if (state.tpr.charged() || state.tpr_threshold.charged()) {
- Genode::warning("tpr not supported by Seoul");
- }
-#endif
- return mtr;
-}
diff --git a/repos/ports/src/app/seoul/state.h b/repos/ports/src/app/seoul/state.h
deleted file mode 100644
index d7c7120640..0000000000
--- a/repos/ports/src/app/seoul/state.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * \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
-
-#include
-
-namespace Seoul {
- void write_vm_state(CpuState &, unsigned mtr, Genode::Vcpu_state &);
- unsigned read_vm_state(Genode::Vcpu_state &, CpuState &);
-}
-
-#endif /* _STATE_H_ */
diff --git a/repos/ports/src/app/seoul/synced_motherboard.h b/repos/ports/src/app/seoul/synced_motherboard.h
deleted file mode 100644
index 4008145a22..0000000000
--- a/repos/ports/src/app/seoul/synced_motherboard.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * \brief Synchronized access to Vancouver motherboard
- * \author Norman Feske
- * \date 2013-05-16
- */
-
-/*
- * Copyright (C) 2013-2017 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 _SYNCED_MOTHERBOARD_H_
-#define _SYNCED_MOTHERBOARD_H_
-
-#include
-#include
-
-typedef Genode::Synced_interface Synced_motherboard;
-
-#endif /* _SYNCED_MOTHERBOARD_H_ */
diff --git a/repos/ports/src/app/seoul/target.mk b/repos/ports/src/app/seoul/target.mk
deleted file mode 100644
index 9361a4d238..0000000000
--- a/repos/ports/src/app/seoul/target.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-TARGET = seoul
-REQUIRES = x86
-
-SEOUL_CONTRIB_DIR = $(call select_from_ports,seoul)/src/app/seoul
-SEOUL_GENODE_DIR = $(SEOUL_CONTRIB_DIR)/genode
-
-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
-
-MODEL_SRC_CC += $(notdir $(wildcard $(SEOUL_CONTRIB_DIR)/model/*.cc))
-EXECUTOR_SRC_CC += $(notdir $(wildcard $(SEOUL_CONTRIB_DIR)/executor/*.cc))
-
-ifneq ($(filter x86_64, $(SPECS)),)
-CC_CXX_OPT += -mcmodel=large
-endif
-
-SRC_CC += $(filter-out $(FILTER_OUT),$(addprefix model/,$(MODEL_SRC_CC)))
-SRC_CC += $(filter-out $(FILTER_OUT),$(addprefix executor/,$(EXECUTOR_SRC_CC)))
-
-INC_DIR += $(SEOUL_CONTRIB_DIR)/include
-INC_DIR += $(SEOUL_GENODE_DIR)/include
-INC_DIR += $(REP_DIR)/src/app/seoul/include
-include $(call select_from_repositories,lib/mk/libc-common.inc)
-
-CC_WARN += -Wno-unused
-
-CC_CXX_OPT += -march=core2
-CC_OPT_model/intel82576vf := -mssse3
-CC_OPT_PIC :=
-
-vpath %.cc $(SEOUL_CONTRIB_DIR)
-vpath %.cc $(REP_DIR)/src/app/seoul
-vpath %.tff $(REP_DIR)/src/app/seoul
-
-CC_CXX_WARN_STRICT_CONVERSION =
diff --git a/repos/ports/src/app/seoul/timeout_late.h b/repos/ports/src/app/seoul/timeout_late.h
deleted file mode 100644
index 0ebe45e60c..0000000000
--- a/repos/ports/src/app/seoul/timeout_late.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * \brief Handle timeouts which are late due to poor signal performance or
- * due to scheduling overload
- * \author Alexander Boettcher
- * \date 2019-05-07
- */
-
-/*
- * Copyright (C) 2019 Genode Labs GmbH
- *
- * This file is distributed under the terms of the GNU General Public License
- * version 2.
- *
- * The code is partially based on the Seoul/Vancouver VMM, which is distributed
- * under the terms of the GNU General Public License version 2.
- *
- * Modifications by Intel Corporation are contributed under the terms and
- * conditions of the GNU General Public License version 2.
- */
-
-#ifndef _TIMEOUT_LATE_H_
-#define _TIMEOUT_LATE_H_
-
-class Late_timeout
-{
- public:
-
- struct Remote
- {
- timevalue _now { 0 };
- timevalue _timeout { 0 };
- unsigned _timer_nr { ~0U };
-
- bool valid() const { return _timer_nr != ~0U; };
- };
-
- private:
-
- Genode::Mutex _mutex { };
- Remote _remote { };
-
- public:
-
- Late_timeout() { }
-
- void timeout(Clock &clock, MessageTimer const &msg)
- {
- Genode::Mutex::Guard guard(_mutex);
-
- Genode::uint64_t const now = clock.time();
-
- if (!_remote._now || now < _remote._now) {
- _remote._now = now;
- _remote._timeout = msg.abstime;
- _remote._timer_nr = msg.nr;
- }
- }
-
- Remote reset()
- {
- Genode::Mutex::Guard guard(_mutex);
-
- Remote last = _remote;
-
- _remote._now = 0;
- _remote._timeout = 0;
- _remote._timer_nr = ~0U;
-
- return last;
- }
-
- bool apply(Remote const &remote,
- unsigned const timer_nr,
- Genode::uint64_t now)
- {
- return (timer_nr == remote._timer_nr) &&
- ((remote._timeout - remote._now) < (now - _remote._now));
- }
-};
-
-#endif /* _TIMEOUT_LATE_H_ */
diff --git a/repos/ports/src/app/seoul/user_env.cc b/repos/ports/src/app/seoul/user_env.cc
deleted file mode 100644
index 4c76bb86da..0000000000
--- a/repos/ports/src/app/seoul/user_env.cc
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * \brief Environment expected by the Seoul code
- * \author Norman Feske
- * \date 2011-11-18
- */
-
-/*
- * 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.
- */
-
-/* Genode includes */
-#include
-#include
-#include
-#include
-#include
-#include
-
-/* Seoul userland includes */
-#include
-#include
-
-enum { verbose_memory_leak = false };
-
-static
-void vprintf(const char *format, va_list &args)
-{
- using namespace Genode;
- static char buf[Log_session::MAX_STRING_LEN-4];
-
- String_console sc(buf, sizeof(buf));
- sc.vprintf(format, args);
-
- int n = sc.len();
- if (0 < n && buf[n-1] == '\n') n--;
-
- log("VMM: ", Cstring(buf, n));
-}
-
-void Logging::printf(const char *format, ...)
-{
- va_list list;
- va_start(list, format);
-
- ::vprintf(format, list);
-
- va_end(list);
-}
-
-
-void Logging::vprintf(const char *format, va_list &ap)
-{
- ::vprintf(format, ap);
-}
-
-
-void Logging::panic(const char *format, ...)
-{
- va_list list;
- va_start(list, format);
-
- Genode::error("VMM PANIC!");
- ::vprintf(format, list);
-
- va_end(list);
-
- for (;;)
- Genode::sleep_forever();
-}
-
-static Genode::Allocator * heap = nullptr;
-
-void heap_init_env(Genode::Heap *h)
-{
- heap = h;
-}
-
-static void *heap_alloc(size_t size)
-{
- void *res = heap->alloc(size);
- if (res)
- return res;
-
- Genode::error("out of memory");
- Genode::sleep_forever();
-}
-
-static void heap_free(void * ptr)
-{
- if (heap->need_size_for_free()) {
- Genode::warning("leaking memory");
- return;
- }
-
- heap->free(ptr, 0);
-}
-
-
-void *operator new[](size_t size)
-{
- void * addr = heap_alloc(size);
- if (addr)
- Genode::memset(addr, 0, size);
-
- return addr;
-}
-
-
-void *operator new[](size_t size, Aligned const alignment)
-{
- size_t align = alignment.alignment;
- void *res = heap_alloc(size + align);
- if (res)
- Genode::memset(res, 0, size + align);
- void *aligned_res = (void *)(((Genode::addr_t)res & ~(align - 1)) + align);
- return aligned_res;
-}
-
-
-void *operator new (size_t size)
-{
- void * addr = heap_alloc(size);
- if (addr)
- Genode::memset(addr, 0, size);
- return addr;
-}
-
-
-void operator delete[](void *ptr)
-{
- if (verbose_memory_leak)
- Genode::warning("delete[] not implemented ", ptr);
-}
-
-
-void operator delete[](void *ptr, long unsigned int)
-{
- if (verbose_memory_leak)
- Genode::warning("delete[] not implemented ", ptr);
-}
-
-
-void operator delete (void * ptr)
-{
- heap_free(ptr);
-}
-
-
-void operator delete(void *ptr, long unsigned int)
-{
- heap_free(ptr);
-}
-
-
-void do_exit(char const *msg)
-{
- Genode::log("*** ", msg);
- Genode::sleep_forever();
-}
-
-
-char __param_table_start;
-char __param_table_end;
-
-/* parameter support */
-#include
-
-Genode::Fifo &Parameter::all_parameters()
-{
- static Genode::Fifo _all_parameters;
- return _all_parameters;
-}
-
-// EOF