Native Solo5 bindings

A shared library implementation of the unikernel middleware.

https://github.com/Solo5/solo5

Fix #2945
This commit is contained in:
Emery Hemingway 2018-11-07 15:16:30 +01:00 committed by Christian Helmuth
parent 5a4dab88d6
commit bc539ce892
27 changed files with 460 additions and 0 deletions

View File

@ -0,0 +1,12 @@
#include <base/fixed_stdint.h>
typedef genode_uint8_t uint8_t;
typedef genode_int8_t int8_t;
typedef genode_uint16_t uint16_t;
typedef genode_int16_t int16_t;
typedef genode_uint32_t uint32_t;
typedef genode_int32_t int32_t;
typedef genode_uint64_t uint64_t;
typedef genode_int64_t int64_t;
typedef unsigned long uintptr_t;
typedef unsigned long size_t;

View File

@ -0,0 +1,4 @@
SOLO5_PORT_DIR := $(call select_from_ports,solo5)
INC_DIR += $(SOLO5_PORT_DIR)/include/solo5
INC_DIR += $(call select_from_repositories,/include/solo5)

View File

@ -0,0 +1,14 @@
REQUIRES += 64bit
SHARED_LIB = yes
include $(REP_DIR)/lib/import/import-solo5.mk
INC_DIR += $(SOLO5_PORT_DIR)/src/lib/solo5/bindings
INC_DIR += $(REP_DIR)/src/lib/solo5
CC_OPT += -D__SOLO5_BINDINGS__ -Drestrict=__restrict__
SRC_CC = bindings.cc
vpath %.cc $(SOLO5_PORT_DIR)/src/lib/solo5/bindings/genode

View File

@ -0,0 +1,13 @@
solo5_abort T
solo5_app_main U
solo5_block_info T
solo5_block_read T
solo5_block_write T
solo5_clock_monotonic T
solo5_clock_wall T
solo5_console_write T
solo5_exit T
solo5_net_info T
solo5_net_read T
solo5_net_write T
solo5_yield T

View File

@ -0,0 +1 @@
38981f1a735dfaa4bffc241db5d3b31e2b47163c

View File

@ -0,0 +1,13 @@
LICENSE := ISC
VERSION := HEAD
DOWNLOADS := solo5.archive
OWNER := Solo5
REPO := solo5
REV := 58e855e149b069174b97176dcc0cba077e8a7440
URL(solo5) := https://github.com/$(OWNER)/$(REPO)/archive/$(REV).tar.gz
SHA(solo5) := b90e727a75b447caa5668c4babf306e1d34c0d1534665900f09d559ef47366a9
DIR(solo5) := src/lib/solo5
DIRS := include/solo5
DIR_CONTENT(include/solo5) = src/lib/solo5/include/solo5/solo5.h

View File

@ -0,0 +1,14 @@
content: include lib/symbols/solo5 LICENSE
PORT_DIR := $(call port_dir,$(REP_DIR)/ports/solo5)/src/lib/solo5
include:
mkdir -p $@
cp -r $(PORT_DIR)/include $@
cp -r $(REP_DIR)/include $@
lib/symbols/solo5:
$(mirror_from_rep_dir)
LICENSE:
cp $(PORT_DIR)/$@ $@

View File

@ -0,0 +1 @@
-

View File

@ -0,0 +1 @@
solo5

View File

@ -0,0 +1,21 @@
PORT_DIR_SOLO5 := $(call port_dir,$(REP_DIR)/ports/solo5)
SRC_DIR = src/lib/solo5
MIRROR_FROM_REP_DIR = \
include/solo5 \
lib/import/import-solo5.mk \
lib/mk/solo5.mk \
content: $(SRC_DIR) $(MIRROR_FROM_REP_DIR)
$(SRC_DIR):
mkdir -p $@
cp -rH $(REP_DIR)/$@/* $@/
cp -r $(PORT_DIR_SOLO5)/$@/* $@/
cp -r $(PORT_DIR_SOLO5)/include/solo5/solo5.h $@/
cp $(PORT_DIR_SOLO5)/$@/LICENSE .
echo 'LIBS=solo5' > $@/target.mk
$(MIRROR_FROM_REP_DIR):
$(mirror_from_rep_dir)

View File

@ -0,0 +1 @@
-

View File

@ -0,0 +1,6 @@
base
os
block_session
nic_session
rtc_session
timer_session

View File

@ -0,0 +1,117 @@
if {![have_spec x86_64]} {
puts "\nSolo5 requires a 64bit architecture\n"
exit 0
}
if {![file exists bin/mirage]} {
puts ""
puts "A mirage image must be provided at 'bin/mirage' to execute this scenario."
puts ""
exit 1
}
if {[have_spec linux]} {
puts ""
puts "This scenario is not available for the Linux platform."
puts ""
exit 1
}
create_boot_directory
import_from_depot \
genodelabs/src/[base_src] \
genodelabs/src/init \
genodelabs/src/rtc_drv \
source ${genode_dir}/repos/base/run/platform_drv.inc
set build_components {
drivers/nic
drivers/rtc
lib/solo5
}
append_platform_drv_build_components
lappend_if [expr {[nic_drv_binary] == "nic_drv"}] build_components drivers/nic
lappend_if [expr {[nic_drv_binary] == "usb_drv"}] build_components drivers/usb
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
lappend_if [have_spec gpio] build_components drivers/gpio
build $build_components
append config {
<config>
<default caps="256"/>
<parent-provides>
<service name="CPU"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="IRQ"/>
<service name="LOG"/>
<service name="PD"/>
<service name="RAM"/>
<service name="RM"/>
<service name="ROM"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service> </default-route>}
append_platform_drv_config
append_if [have_spec gpio] config "
<start name=\"[gpio_drv]\" caps=\"140\">
<resource name=\"RAM\" quantum=\"4M\"/>
<provides><service name=\"Gpio\"/></provides>
<config/>
</start>"
append config {
<start name="timer" caps="96">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="nic_drv">
<binary name="} [nic_drv_binary] {"/>
<resource name="RAM" quantum="4M"/>
<provides><service name="Nic"/></provides>
</start>
<start name="rtc_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Rtc"/></provides>
</start>
<start name="mirage" caps="256">
<resource name="RAM" quantum="32M"/>
<config> <nic/> <rtc/> </config>
</start>
</config>
}
install_config $config
set boot_modules {
mirage
rtc_drv
solo5.lib.so
}
# platform-specific modules
append_platform_drv_boot_modules
lappend boot_modules [nic_drv_binary]
lappend_if [have_spec gpio] boot_modules [gpio_drv]
build_boot_image $boot_modules
append qemu_args " -nographic -net user"
append_if [have_spec x86] qemu_args " -net nic,model=e1000 "
append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "
run_genode_until forever

View File

@ -0,0 +1,99 @@
if {![have_spec 64bit]} {
puts "\nSolo5 requires a 64bit architecture\n"
exit 0
}
if {[have_spec linux]} {
puts "\nRunscript not compatible with base-linux drivers\n"
exit 0
}
create_boot_directory
import_from_depot \
genodelabs/src/[base_src] \
genodelabs/src/init \
genodelabs/src/rtc_drv \
install_config {
<config>
<parent-provides>
<service name="CPU"/>
<service name="LOG"/>
<service name="PD"/>
<service name="RAM"/>
<service name="ROM"/>
<service name="IO_PORT"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service> </default-route>
<start name="timer" caps="96">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="rtc_drv" caps="96">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Rtc"/> </provides>
</start>
<start name="nic_loopback" caps="96">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Nic"/> </provides>
</start>
<start name="ram_blk" caps="96">
<resource name="RAM" quantum="40M"/>
<provides> <service name="Block"/> </provides>
<config size="32M" block_size="4096"/>
</start>
<start name="test" caps="256">
<binary name="sequence"/>
<resource name="RAM" quantum="16M"/>
<config>
<start name="solo5-test_hello">
<config>
<solo5 cmdline="Hello_Solo5"/>
<rtc/> <nic/> <blk/>
</config>
</start>
<start name="solo5-test_fpu"/>
<start name="solo5-test_globals"/>
<start name="solo5-test_quiet"/>
<start name="solo5-test_blk">
<config> <blk/> </config>
</start>
<start name="solo5-test_time">
<config> <rtc/> </config>
</start>
</config>
</start>
</config>
}
build {
app/sequence
server/nic_loopback
server/ram_blk
test/solo5
}
build_boot_image {
nic_loopback
ram_blk
sequence
solo5.lib.so
solo5-test_blk
solo5-test_fpu
solo5-test_globals
solo5-test_hello
solo5-test_quiet
solo5-test_time
}
append qemu_args " -nographic "
run_genode_until {child "test" exited with exit value 0} 40

View File

@ -0,0 +1,123 @@
if {![have_spec x86_64]} {
puts "\nSolo5 requires a 64bit architecture\n"
exit 0
}
if {[have_spec linux]} {
puts "\nRunscript not compatible with base-linux drivers\n"
exit 0
}
create_boot_directory
import_from_depot \
genodelabs/src/[base_src] \
genodelabs/src/init \
genodelabs/src/rtc_drv \
source ${genode_dir}/repos/base/run/platform_drv.inc
append config {
<config>
<parent-provides>
<service name="ROM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<default caps="128"/>}
append_platform_drv_config
append config {
<start name="timer" caps="96">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="rtc_drv" caps="96">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Rtc"/> </provides>
</start>
<start name="nic_drv" caps="150">
<binary name="} [nic_drv_binary] {"/>
<resource name="RAM" quantum="20M"/>
<provides><service name="Nic"/></provides>
} [nic_drv_config] {
</start>
<start name="nic_bridge" caps="200">
<resource name="RAM" quantum="8M"/>
<provides><service name="Nic"/></provides>
<config mac="02:02:02:02:03:00">
<policy label_prefix="solo5" ip_addr="10.0.0.2"/>
<default-policy/>
</config>
<route>
<service name="Nic"> <child name="nic_drv"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="solo5-test_ping_serve" caps="256">
<resource name="RAM" quantum="4M"/>
<config>
<solo5 cmdline="limit"/>
<nic/>
</config>
<route>
<service name="Nic"> <child name="nic_bridge"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="ping">
<resource name="RAM" quantum="8M"/>
<config interface="10.0.0.72/24"
dst_ip="10.0.0.2"
period_sec="1"
verbose="no"
count="8"/>
<route>
<service name="Nic"> <child name="nic_bridge"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
</config>
}
install_config $config
append build_components {
app/ping
drivers/nic
server/nic_bridge
test/solo5/ping_serve
}
append_platform_drv_build_components
build $build_components
append boot_modules {
nic_bridge
ping
} [nic_drv_binary] {
solo5-test_ping_serve
solo5.lib.so
}
append_platform_drv_boot_modules
build_boot_image $boot_modules
append qemu_args " -nographic "
run_genode_until {child "ping" exited with exit value 0} 60

View File

@ -0,0 +1,2 @@
TARGET = dummy-solo5
LIBS = solo5

View File

@ -0,0 +1 @@
include $(REP_DIR)/src/test/solo5/test.inc

View File

@ -0,0 +1 @@
include $(REP_DIR)/src/test/solo5/test.inc

View File

@ -0,0 +1 @@
include $(REP_DIR)/src/test/solo5/test.inc

View File

@ -0,0 +1 @@
include $(REP_DIR)/src/test/solo5/test.inc

View File

@ -0,0 +1 @@
include $(REP_DIR)/src/test/solo5/test.inc

View File

@ -0,0 +1 @@
include $(REP_DIR)/src/test/solo5/test.inc

View File

@ -0,0 +1 @@
include $(REP_DIR)/src/test/solo5/test.inc

View File

@ -0,0 +1 @@
include $(REP_DIR)/src/test/solo5/test.inc

View File

@ -0,0 +1,8 @@
TEST_NAME := test_$(subst $(REP_DIR)/src/test/solo5/,,$(PRG_DIR))
TARGET = solo5-$(TEST_NAME)
LIBS += solo5
SRC_C += $(TEST_NAME).c
vpath %.c $(call select_from_ports,solo5)/src/lib/solo5/tests/$(TEST_NAME)

View File

@ -0,0 +1 @@
include $(REP_DIR)/src/test/solo5/test.inc

View File

@ -97,6 +97,7 @@ seoul-auto
signal
slab
smartcard
solo5
stdcxx
sub_rm
synced_interface