Removal of deprecated os/config.h (Ref #74)
This commit is contained in:
committed by
Norman Feske
parent
c9f593d803
commit
0c7450c550
@@ -3,7 +3,7 @@
|
||||
|
||||
SRC_CC += backend/nic_ip/backend.cc
|
||||
|
||||
LIBS += base config net
|
||||
LIBS += base net
|
||||
|
||||
# include less specific configuration
|
||||
# include less specificuration
|
||||
include $(REP_DIR)/lib/mk/remote_rom_backend.inc
|
||||
|
||||
@@ -13,9 +13,9 @@ create_boot_directory
|
||||
install_config {
|
||||
<config>
|
||||
<parent-provides>
|
||||
<service name="CAP"/>
|
||||
<service name="LOG"/>
|
||||
<service name="RM"/>
|
||||
<service name="PD"/>
|
||||
<service name="CPU"/>
|
||||
<service name="SIGNAL"/>
|
||||
|
||||
<!-- some timer implementations need kernel info pages -->
|
||||
@@ -29,22 +29,19 @@ install_config {
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
|
||||
|
||||
<start name="fesrv">
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
<default caps="100"/>
|
||||
<start name="fesrv">
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
<config>
|
||||
<fesrv image="riscv-image.elf" />
|
||||
|
||||
<libc stdout="/dev/log" stderr="/dev/log" >
|
||||
<vfs>
|
||||
<rom name="riscv-image.elf"/>
|
||||
</vfs>
|
||||
</libc>
|
||||
</config>
|
||||
</start>
|
||||
|
||||
</config>}
|
||||
</start>
|
||||
</config> }
|
||||
|
||||
#
|
||||
# Boot image
|
||||
|
||||
@@ -25,7 +25,6 @@ set config {
|
||||
<config>
|
||||
<default caps="128"/>
|
||||
<parent-provides>
|
||||
<service name="CAP"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
<service name="PD"/>
|
||||
@@ -36,6 +35,7 @@ set config {
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<default caps="100"/>
|
||||
<start name="timer">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides> <service name="Timer"/> </provides>
|
||||
|
||||
@@ -38,8 +38,9 @@
|
||||
|
||||
#include "htif.h"
|
||||
|
||||
#include <os/attached_io_mem_dataspace.h>
|
||||
#include <os/config.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/attached_io_mem_dataspace.h>
|
||||
#include <libc/component.h>
|
||||
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
@@ -50,15 +51,15 @@
|
||||
class Htif_zedboard_genode : public htif_t
|
||||
{
|
||||
public:
|
||||
Htif_zedboard_genode( std::string image = "image.elf" ):
|
||||
htif_t( std::vector<std::string>( { image } ) ),
|
||||
_io_mem_dataspace( DEV_PADDR, 2 * sizeof( uintptr_t ), true ),
|
||||
dev_vaddr( _io_mem_dataspace.local_addr<uintptr_t>() )
|
||||
|
||||
{
|
||||
write_reg( 31, 0 ); // reset
|
||||
}
|
||||
Htif_zedboard_genode(Libc::Env & env, std::string image = "image.elf")
|
||||
: htif_t( std::vector<std::string>( { image } ) ),
|
||||
_io_mem_dataspace(env, DEV_PADDR, 2 * sizeof( uintptr_t ), true ),
|
||||
dev_vaddr( _io_mem_dataspace.local_addr<uintptr_t>() ) {
|
||||
write_reg( 31, 0 ); /* reset */ }
|
||||
|
||||
protected:
|
||||
|
||||
ssize_t read( void *buf, size_t max_size )
|
||||
{
|
||||
uint32_t *x = ( uint32_t * )buf;
|
||||
@@ -67,75 +68,68 @@ class Htif_zedboard_genode : public htif_t
|
||||
uintptr_t c = read_reg( 0 );
|
||||
uint32_t count = 0;
|
||||
|
||||
if ( c > 0 )
|
||||
{
|
||||
for ( count=0; count<c && count*sizeof( *x )<max_size; count++ )
|
||||
{
|
||||
x[count] = read_reg( 1 );
|
||||
}
|
||||
if ( c > 0 ) {
|
||||
for ( count=0; count<c && count*sizeof( *x )<max_size; count++ ) {
|
||||
x[count] = read_reg( 1 ); }
|
||||
}
|
||||
|
||||
return count*sizeof( *x );
|
||||
}
|
||||
|
||||
ssize_t write( const void *buf, size_t size )
|
||||
{
|
||||
const uint32_t *x = ( const uint32_t * )buf;
|
||||
assert( size >= sizeof( *x ) );
|
||||
|
||||
for ( uint32_t i = 0; i < size/sizeof( *x ); i++ )
|
||||
{
|
||||
write_reg( 0, x[i] );
|
||||
}
|
||||
for ( uint32_t i = 0; i < size/sizeof( *x ); i++ ) {
|
||||
write_reg( 0, x[i] ); }
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
size_t chunk_max_size() { return 64; }
|
||||
size_t chunk_align() { return 64; }
|
||||
uint32_t mem_mb() { return 256; }
|
||||
uint32_t num_cores() { return 1; }
|
||||
size_t chunk_max_size() { return 64; }
|
||||
size_t chunk_align() { return 64; }
|
||||
uint32_t mem_mb() { return 256; }
|
||||
uint32_t num_cores() { return 1; }
|
||||
|
||||
private:
|
||||
|
||||
Genode::Attached_io_mem_dataspace _io_mem_dataspace;
|
||||
volatile uintptr_t *dev_vaddr;
|
||||
|
||||
const static uintptr_t DEV_PADDR = 0x43C00000;
|
||||
};
|
||||
|
||||
static const std::string image_name()
|
||||
|
||||
static const std::string image_name(Libc::Env & env)
|
||||
{
|
||||
static const size_t LEN = 128;
|
||||
char buf[LEN];
|
||||
Genode::memset( buf, 0, LEN );
|
||||
|
||||
try
|
||||
{
|
||||
Genode::config()->xml_node().sub_node( "fesrv" ).attribute( "image" ).value(
|
||||
buf, LEN - 1 );
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
try {
|
||||
Genode::Attached_rom_dataspace config(env, "config");
|
||||
config.xml().sub_node( "fesrv" ).attribute( "image" ).value(buf, LEN - 1 );
|
||||
} catch ( ... ) {
|
||||
throw std::runtime_error( "elf-image not configured" );
|
||||
}
|
||||
|
||||
return std::string( buf );
|
||||
}
|
||||
|
||||
int main()
|
||||
|
||||
void Libc::Component::construct(Libc::Env & env)
|
||||
{
|
||||
try
|
||||
{
|
||||
auto image = image_name();
|
||||
Htif_zedboard_genode htif( image );
|
||||
Genode::log( "Initialized Htif_zedboard with ", image.c_str() );
|
||||
htif.run();
|
||||
}
|
||||
catch ( const std::runtime_error &e )
|
||||
{
|
||||
Genode::error( "Caught runtime error: ", e.what() );
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
Genode::error( "Unknown error occured" );
|
||||
}
|
||||
Libc::with_libc([&] () {
|
||||
try {
|
||||
std::string image = image_name(env);
|
||||
Htif_zedboard_genode htif(env, image);
|
||||
Genode::log( "Initialized Htif_zedboard with ", image.c_str() );
|
||||
htif.run();
|
||||
} catch ( const std::runtime_error &e ) {
|
||||
Genode::error( "Caught runtime error: ", e.what() );
|
||||
} catch ( ... ) {
|
||||
Genode::error( "Unknown error occured" );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ SRC_CC = main.cc \
|
||||
term.cc
|
||||
|
||||
TARGET = fesrv
|
||||
LIBS = stdcxx posix
|
||||
LIBS = stdcxx libc
|
||||
INC_DIR += $(FESRV_SRC)
|
||||
|
||||
# Some defines to keep the fesrv compilation process happy
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <rtc_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <os/path.h>
|
||||
#include <os/config.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/env.h>
|
||||
#include <base/printf.h>
|
||||
#include <util/string.h>
|
||||
@@ -525,15 +525,16 @@ int sqlite3_os_init(void)
|
||||
return SQLITE_ERROR;
|
||||
}
|
||||
|
||||
Genode::Attached_rom_dataspace config("config");
|
||||
Vfs::Dir_file_system *genode_vfs = nullptr;
|
||||
try {
|
||||
Xml_node node = Genode::config()->xml_node().sub_node("sqlite").sub_node("vfs");
|
||||
Xml_node node = config.xml().sub_node("sqlite").sub_node("vfs");
|
||||
genode_vfs = new (Genode::env()->heap())
|
||||
Vfs::Dir_file_system(node, Vfs::global_file_system_factory());
|
||||
|
||||
} catch (Genode::Xml_node::Nonexistent_sub_node) {
|
||||
try {
|
||||
Xml_node node = Genode::config()->xml_node().sub_node("vfs");
|
||||
Xml_node node = config.xml().sub_node("vfs");
|
||||
genode_vfs = new (Genode::env()->heap())
|
||||
Vfs::Dir_file_system(node, Vfs::global_file_system_factory());
|
||||
PWRN("additional VFS created for SQLite");
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -5,9 +7,11 @@ extern "C" {
|
||||
|
||||
void gdef_GetHostName (char machine[], int n)
|
||||
{
|
||||
strncpy(machine, "genode", n);
|
||||
Genode::Attached_rom_dataspace config("config");
|
||||
try { config.xml().attribute("hostname").value(machine, n); }
|
||||
catch (...) { Genode::strncpy(machine, "genode", n); }
|
||||
}
|
||||
|
||||
void gdef_WriteHostName (void) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
SRC_CC = main.cc
|
||||
TARGET = remote_rom_client
|
||||
|
||||
LIBS += base config
|
||||
LIBS += base
|
||||
|
||||
INC_DIR += $(REP_DIR)/include/remote_rom
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
SRC_CC = main.cc
|
||||
TARGET = remote_rom_server
|
||||
|
||||
LIBS += base config
|
||||
LIBS += base
|
||||
|
||||
INC_DIR += $(REP_DIR)/include/remote_rom
|
||||
|
||||
|
||||
Reference in New Issue
Block a user