mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-17 14:48:20 +00:00
base-linux: coding style
This commit is contained in:
committed by
Christian Helmuth
parent
dc016cbd5c
commit
0dcb526ae5
@ -79,6 +79,7 @@ inline int lx_iopl(int level)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
** Functions used by core's io mem session code **
|
** Functions used by core's io mem session code **
|
||||||
**************************************************/
|
**************************************************/
|
||||||
@ -261,5 +262,4 @@ inline int lx_read(int fd, void *buf, Genode::size_t count)
|
|||||||
return lx_syscall(SYS_read, fd, buf, count);
|
return lx_syscall(SYS_read, fd, buf, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* _CORE__INCLUDE__CORE_LINUX_SYSCALLS_H_ */
|
#endif /* _CORE__INCLUDE__CORE_LINUX_SYSCALLS_H_ */
|
||||||
|
@ -28,14 +28,19 @@
|
|||||||
#include <base/internal/capability_space_tpl.h>
|
#include <base/internal/capability_space_tpl.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
|
class Dataspace_owner;
|
||||||
|
class Dataspace_component;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
|
/**
|
||||||
* Deriving classes can own a dataspace to implement conditional behavior
|
* Deriving classes can own a dataspace to implement conditional behavior
|
||||||
*/
|
*/
|
||||||
class Dataspace_owner : Interface { };
|
class Genode::Dataspace_owner : Interface { };
|
||||||
|
|
||||||
class Dataspace_component : public Rpc_object<Linux_dataspace>
|
|
||||||
{
|
class Genode::Dataspace_component : public Rpc_object<Linux_dataspace>
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Filename _fname { }; /* filename for mmap */
|
Filename _fname { }; /* filename for mmap */
|
||||||
@ -44,8 +49,10 @@ namespace Genode {
|
|||||||
Native_capability _cap; /* capability / file descriptor */
|
Native_capability _cap; /* capability / file descriptor */
|
||||||
bool const _writable; /* false if read-only */
|
bool const _writable; /* false if read-only */
|
||||||
|
|
||||||
/* Holds the dataspace owner if a distinction between owner and
|
/*
|
||||||
* others is necessary on the dataspace, otherwise it is 0 */
|
* Holds the dataspace owner if a distinction between owner and
|
||||||
|
* others is necessary on the dataspace, otherwise it is 0
|
||||||
|
*/
|
||||||
Dataspace_owner const * const _owner;
|
Dataspace_owner const * const _owner;
|
||||||
|
|
||||||
static Filename _file_name(const char *args);
|
static Filename _file_name(const char *args);
|
||||||
@ -70,14 +77,17 @@ namespace Genode {
|
|||||||
Dataspace_component(size_t size, addr_t addr,
|
Dataspace_component(size_t size, addr_t addr,
|
||||||
Cache_attribute, bool writable,
|
Cache_attribute, bool writable,
|
||||||
Dataspace_owner * owner)
|
Dataspace_owner * owner)
|
||||||
: _size(size), _addr(addr), _cap(), _writable(writable),
|
:
|
||||||
_owner(owner) { }
|
_size(size), _addr(addr), _cap(), _writable(writable), _owner(owner)
|
||||||
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor returns invalid dataspace
|
* Default constructor creates invalid dataspace
|
||||||
*/
|
*/
|
||||||
Dataspace_component()
|
Dataspace_component()
|
||||||
: _size(0), _addr(0), _cap(), _writable(false), _owner(nullptr) { }
|
:
|
||||||
|
_size(0), _addr(0), _cap(), _writable(false), _owner(nullptr)
|
||||||
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This constructor is only provided for compatibility
|
* This constructor is only provided for compatibility
|
||||||
@ -128,7 +138,6 @@ namespace Genode {
|
|||||||
Filename fname() override { return _fname; }
|
Filename fname() override { return _fname; }
|
||||||
|
|
||||||
Untyped_capability fd() override { return _cap; }
|
Untyped_capability fd() override { return _cap; }
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _CORE__INCLUDE__DATASPACE_COMPONENT_H_ */
|
#endif /* _CORE__INCLUDE__DATASPACE_COMPONENT_H_ */
|
||||||
|
@ -22,11 +22,11 @@
|
|||||||
/* core includes */
|
/* core includes */
|
||||||
#include <dataspace_component.h>
|
#include <dataspace_component.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode { class Io_mem_session_component; }
|
||||||
|
|
||||||
class Io_mem_session_component : public Rpc_object<Io_mem_session>
|
|
||||||
{
|
|
||||||
|
|
||||||
|
class Genode::Io_mem_session_component : public Rpc_object<Io_mem_session>
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Range_allocator &_io_mem_alloc;
|
Range_allocator &_io_mem_alloc;
|
||||||
@ -68,7 +68,6 @@ namespace Genode {
|
|||||||
*****************************/
|
*****************************/
|
||||||
|
|
||||||
Io_mem_dataspace_capability dataspace() override;
|
Io_mem_dataspace_capability dataspace() override;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _CORE__INCLUDE__IO_MEM_SESSION_COMPONENT_H_ */
|
#endif /* _CORE__INCLUDE__IO_MEM_SESSION_COMPONENT_H_ */
|
||||||
|
@ -16,19 +16,16 @@
|
|||||||
|
|
||||||
#include <base/thread.h>
|
#include <base/thread.h>
|
||||||
|
|
||||||
namespace Genode
|
namespace Genode { class Irq_object; };
|
||||||
{
|
|
||||||
class Irq_object;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Genode::Irq_object : public Thread_deprecated<4096>
|
class Genode::Irq_object : public Thread_deprecated<4096>
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Genode::Signal_context_capability _sig_cap;
|
Signal_context_capability _sig_cap;
|
||||||
Genode::Blockade _sync_ack { };
|
Blockade _sync_ack { };
|
||||||
Genode::Blockade _sync_bootup { };
|
Blockade _sync_bootup { };
|
||||||
unsigned const _irq;
|
unsigned const _irq;
|
||||||
int _fd;
|
int _fd;
|
||||||
|
|
||||||
|
@ -20,9 +20,8 @@
|
|||||||
#include <irq_session/irq_session.h>
|
#include <irq_session/irq_session.h>
|
||||||
#include <irq_object.h>
|
#include <irq_object.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode { class Irq_session_component; }
|
||||||
class Irq_session_component;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Genode::Irq_session_component : public Rpc_object<Irq_session>,
|
class Genode::Irq_session_component : public Rpc_object<Irq_session>,
|
||||||
private List<Irq_session_component>::Element
|
private List<Irq_session_component>::Element
|
||||||
@ -30,8 +29,10 @@ class Genode::Irq_session_component : public Rpc_object<Irq_session>,
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
friend class List<Irq_session_component>;
|
friend class List<Irq_session_component>;
|
||||||
|
|
||||||
unsigned _irq_number;
|
unsigned _irq_number;
|
||||||
Genode::Irq_object _irq_object;
|
|
||||||
|
Irq_object _irq_object;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include <linux_native_cpu/linux_native_cpu.h>
|
#include <linux_native_cpu/linux_native_cpu.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
|
|
||||||
class Cpu_session_component;
|
class Cpu_session_component;
|
||||||
class Native_cpu_component;
|
class Native_cpu_component;
|
||||||
}
|
}
|
||||||
@ -37,6 +36,7 @@ class Genode::Native_cpu_component : public Rpc_object<Linux_native_cpu,
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
Native_cpu_component(Cpu_session_component &, char const *);
|
Native_cpu_component(Cpu_session_component &, char const *);
|
||||||
|
|
||||||
~Native_cpu_component();
|
~Native_cpu_component();
|
||||||
|
|
||||||
void thread_id(Thread_capability, int, int) override;
|
void thread_id(Thread_capability, int, int) override;
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include <linux_native_pd/linux_native_pd.h>
|
#include <linux_native_pd/linux_native_pd.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
|
|
||||||
class Dataspace_component;
|
class Dataspace_component;
|
||||||
class Pd_session_component;
|
class Pd_session_component;
|
||||||
class Native_pd_component;
|
class Native_pd_component;
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
* \author Norman Feske
|
* \author Norman Feske
|
||||||
* \author Christian Helmuth
|
* \author Christian Helmuth
|
||||||
* \date 2006-04-28
|
* \date 2006-04-28
|
||||||
*
|
|
||||||
* Linux dummies
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -26,9 +24,13 @@
|
|||||||
#include <rpc_cap_factory.h>
|
#include <rpc_cap_factory.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
|
struct Pager_object;
|
||||||
|
struct Pager_entrypoint;
|
||||||
|
}
|
||||||
|
|
||||||
struct Pager_object
|
|
||||||
{
|
struct Genode::Pager_object
|
||||||
|
{
|
||||||
Thread_capability _thread_cap { };
|
Thread_capability _thread_cap { };
|
||||||
Signal_context_capability _sigh { };
|
Signal_context_capability _sigh { };
|
||||||
|
|
||||||
@ -42,10 +44,11 @@ namespace Genode {
|
|||||||
*/
|
*/
|
||||||
Thread_capability thread_cap() const { return _thread_cap; }
|
Thread_capability thread_cap() const { return _thread_cap; }
|
||||||
void thread_cap(Thread_capability cap) { _thread_cap = cap; }
|
void thread_cap(Thread_capability cap) { _thread_cap = cap; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Pager_entrypoint
|
|
||||||
{
|
struct Genode::Pager_entrypoint
|
||||||
|
{
|
||||||
Pager_entrypoint(Rpc_cap_factory &) { }
|
Pager_entrypoint(Rpc_cap_factory &) { }
|
||||||
|
|
||||||
template <typename FUNC>
|
template <typename FUNC>
|
||||||
@ -55,7 +58,6 @@ namespace Genode {
|
|||||||
Pager_capability manage(Pager_object &) { return Pager_capability(); }
|
Pager_capability manage(Pager_object &) { return Pager_capability(); }
|
||||||
|
|
||||||
void dissolve(Pager_object &) { }
|
void dissolve(Pager_object &) { }
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _CORE__INCLUDE__PAGER_H_ */
|
#endif /* _CORE__INCLUDE__PAGER_H_ */
|
||||||
|
@ -15,16 +15,17 @@
|
|||||||
#ifndef _CORE__INCLUDE__PLATFORM_H_
|
#ifndef _CORE__INCLUDE__PLATFORM_H_
|
||||||
#define _CORE__INCLUDE__PLATFORM_H_
|
#define _CORE__INCLUDE__PLATFORM_H_
|
||||||
|
|
||||||
|
/* Genode includes */
|
||||||
#include <base/allocator_avl.h>
|
#include <base/allocator_avl.h>
|
||||||
#include <base/lock_guard.h>
|
#include <util/arg_string.h>
|
||||||
|
|
||||||
|
/* core-local includes */
|
||||||
#include <platform_generic.h>
|
#include <platform_generic.h>
|
||||||
#include <platform_pd.h>
|
#include <platform_pd.h>
|
||||||
#include <platform_thread.h>
|
#include <platform_thread.h>
|
||||||
#include <synced_range_allocator.h>
|
#include <synced_range_allocator.h>
|
||||||
#include <assertion.h>
|
#include <assertion.h>
|
||||||
|
|
||||||
#include <util/arg_string.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of Unix environment variables, initialized by the startup code
|
* List of Unix environment variables, initialized by the startup code
|
||||||
@ -37,9 +38,11 @@ extern char **lx_environ;
|
|||||||
*/
|
*/
|
||||||
static unsigned long ram_quota_from_env()
|
static unsigned long ram_quota_from_env()
|
||||||
{
|
{
|
||||||
|
using namespace Genode;
|
||||||
|
|
||||||
for (char **curr = lx_environ; curr && *curr; curr++) {
|
for (char **curr = lx_environ; curr && *curr; curr++) {
|
||||||
|
|
||||||
Genode::Arg arg = Genode::Arg_string::find_arg(*curr, "GENODE_RAM_QUOTA");
|
Arg arg = Arg_string::find_arg(*curr, "GENODE_RAM_QUOTA");
|
||||||
if (arg.valid())
|
if (arg.valid())
|
||||||
return arg.ulong_value(~0);
|
return arg.ulong_value(~0);
|
||||||
}
|
}
|
||||||
@ -47,12 +50,9 @@ static unsigned long ram_quota_from_env()
|
|||||||
return ~0;
|
return ~0;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Genode {
|
|
||||||
|
|
||||||
using namespace Genode;
|
class Genode::Platform : public Platform_generic
|
||||||
|
{
|
||||||
class Platform : public Platform_generic
|
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -153,7 +153,6 @@ namespace Genode {
|
|||||||
size_t max_caps() const override { return 10000; }
|
size_t max_caps() const override { return 10000; }
|
||||||
|
|
||||||
void wait_for_exit() override;
|
void wait_for_exit() override;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _CORE__INCLUDE__PLATFORM_H_ */
|
#endif /* _CORE__INCLUDE__PLATFORM_H_ */
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
* \brief Linux protection domain facility
|
* \brief Linux protection domain facility
|
||||||
* \author Norman Feske
|
* \author Norman Feske
|
||||||
* \date 2006-06-13
|
* \date 2006-06-13
|
||||||
*
|
|
||||||
* Pretty dumb.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -24,6 +22,7 @@ namespace Genode {
|
|||||||
struct Platform_thread;
|
struct Platform_thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct Genode::Platform_pd
|
struct Genode::Platform_pd
|
||||||
{
|
{
|
||||||
Platform_pd(Allocator &, char const *) { }
|
Platform_pd(Allocator &, char const *) { }
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
* \brief Linux thread facility
|
* \brief Linux thread facility
|
||||||
* \author Norman Feske
|
* \author Norman Feske
|
||||||
* \date 2006-06-13
|
* \date 2006-06-13
|
||||||
*
|
|
||||||
* Pretty dumb.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -25,11 +23,10 @@
|
|||||||
/* core includes */
|
/* core includes */
|
||||||
#include <pager.h>
|
#include <pager.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode { class Platform_thread; }
|
||||||
|
|
||||||
class Platform_thread;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We hold all Platform_thread objects in a list in order to be able to
|
* We hold all Platform_thread objects in a list in order to be able to
|
||||||
* reflect SIGCHLD as exception signals. When a SIGCHILD occurs, we
|
* reflect SIGCHLD as exception signals. When a SIGCHILD occurs, we
|
||||||
* determine the PID of the terminated child process via 'wait4'. We use
|
* determine the PID of the terminated child process via 'wait4'. We use
|
||||||
@ -37,8 +34,8 @@ namespace Genode {
|
|||||||
* turn, we find the exception handler's 'Signal_context_capability'.
|
* turn, we find the exception handler's 'Signal_context_capability'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Platform_thread : public List<Platform_thread>::Element
|
class Genode::Platform_thread : public List<Platform_thread>::Element
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
struct Registry
|
struct Registry
|
||||||
@ -153,7 +150,6 @@ namespace Genode {
|
|||||||
Trace::Execution_time execution_time() const { return { 0, 0 }; }
|
Trace::Execution_time execution_time() const { return { 0, 0 }; }
|
||||||
|
|
||||||
unsigned long pager_object_badge() const { return 0; }
|
unsigned long pager_object_badge() const { return 0; }
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _CORE__INCLUDE__PLATFORM_THREAD_H_ */
|
#endif /* _CORE__INCLUDE__PLATFORM_THREAD_H_ */
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
* \brief Core-specific instance of the region-map interface
|
* \brief Core-specific instance of the region-map interface
|
||||||
* \author Christian Helmuth
|
* \author Christian Helmuth
|
||||||
* \date 2006-07-17
|
* \date 2006-07-17
|
||||||
*
|
|
||||||
* Dummies for Linux platform
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -75,8 +73,8 @@ struct Genode::Rm_client : Pager_object
|
|||||||
{
|
{
|
||||||
Rm_client(Cpu_session_capability, Thread_capability,
|
Rm_client(Cpu_session_capability, Thread_capability,
|
||||||
Region_map_component &, unsigned long,
|
Region_map_component &, unsigned long,
|
||||||
Affinity::Location, Cpu_session::Name const&,
|
Affinity::Location, Cpu_session::Name const &,
|
||||||
Session_label const&)
|
Session_label const &)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
/* Linux includes */
|
/* Linux includes */
|
||||||
#include <core_linux_syscalls.h>
|
#include <core_linux_syscalls.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
|
|
||||||
@ -88,7 +87,8 @@ static void sigchld_handler(int)
|
|||||||
|
|
||||||
|
|
||||||
Platform::Platform()
|
Platform::Platform()
|
||||||
: _core_mem_alloc(nullptr)
|
:
|
||||||
|
_core_mem_alloc(nullptr)
|
||||||
{
|
{
|
||||||
/* make 'mmap' behave deterministically */
|
/* make 'mmap' behave deterministically */
|
||||||
lx_disable_aslr();
|
lx_disable_aslr();
|
||||||
|
@ -38,7 +38,7 @@ Linux_dataspace::Filename Dataspace_component::_file_name(const char *args)
|
|||||||
Linux_dataspace::Filename fname;
|
Linux_dataspace::Filename fname;
|
||||||
|
|
||||||
if (label.last_element().length() > sizeof(fname.buf)) {
|
if (label.last_element().length() > sizeof(fname.buf)) {
|
||||||
Genode::error("file name too long: ", label.last_element());
|
error("file name too long: ", label.last_element());
|
||||||
throw Service_denied();
|
throw Service_denied();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ Linux_dataspace::Filename Dataspace_component::_file_name(const char *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Genode::size_t Dataspace_component::_file_size()
|
size_t Dataspace_component::_file_size()
|
||||||
{
|
{
|
||||||
struct stat64 s;
|
struct stat64 s;
|
||||||
if (lx_stat(_fname.buf, &s) < 0) throw Service_denied();
|
if (lx_stat(_fname.buf, &s) < 0) throw Service_denied();
|
||||||
@ -62,15 +62,19 @@ Genode::size_t Dataspace_component::_file_size()
|
|||||||
|
|
||||||
|
|
||||||
Dataspace_component::Dataspace_component(const char *args)
|
Dataspace_component::Dataspace_component(const char *args)
|
||||||
: _fname(_file_name(args)),
|
:
|
||||||
|
_fname(_file_name(args)),
|
||||||
_size(_file_size()),
|
_size(_file_size()),
|
||||||
_addr(0),
|
_addr(0),
|
||||||
_cap(_fd_to_cap(lx_open(_fname.buf, O_RDONLY | LX_O_CLOEXEC, S_IRUSR | S_IXUSR))),
|
_cap(_fd_to_cap(lx_open(_fname.buf, O_RDONLY | LX_O_CLOEXEC, S_IRUSR | S_IXUSR))),
|
||||||
_writable(false),
|
_writable(false),
|
||||||
_owner(0) { }
|
_owner(0)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
|
||||||
Dataspace_component::Dataspace_component(size_t size, addr_t, addr_t phys_addr,
|
Dataspace_component::Dataspace_component(size_t size, addr_t, addr_t phys_addr,
|
||||||
Cache_attribute, bool, Dataspace_owner *_owner) :
|
Cache_attribute, bool, Dataspace_owner *_owner)
|
||||||
|
:
|
||||||
_size(size), _addr(phys_addr), _cap(), _writable(false), _owner(_owner)
|
_size(size), _addr(phys_addr), _cap(), _writable(false), _owner(_owner)
|
||||||
{
|
{
|
||||||
warning("Should only be used for IOMEM and not within Linux.");
|
warning("Should only be used for IOMEM and not within Linux.");
|
||||||
|
@ -11,17 +11,20 @@
|
|||||||
* under the terms of the GNU Affero General Public License version 3.
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Genode includes */
|
||||||
#include <base/log.h>
|
#include <base/log.h>
|
||||||
#include <linux_dataspace/client.h>
|
#include <linux_dataspace/client.h>
|
||||||
#include <base/internal/page_size.h>
|
|
||||||
|
|
||||||
#include <core_linux_syscalls.h>
|
|
||||||
|
|
||||||
#include <io_mem_session_component.h>
|
#include <io_mem_session_component.h>
|
||||||
|
|
||||||
|
/* base-internal includes */
|
||||||
|
#include <base/internal/page_size.h>
|
||||||
|
|
||||||
|
/* core-local includes */
|
||||||
|
#include <core_linux_syscalls.h>
|
||||||
|
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
|
|
||||||
size_t Io_mem_session_component::get_arg_size(const char *)
|
size_t Io_mem_session_component::get_arg_size(const char *)
|
||||||
{
|
{
|
||||||
warning(__func__, " not implemented");
|
warning(__func__, " not implemented");
|
||||||
@ -35,16 +38,20 @@ addr_t Io_mem_session_component::get_arg_phys(const char *)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Io_mem_session_component::Io_mem_session_component(Range_allocator &io_mem_alloc,
|
Io_mem_session_component::Io_mem_session_component(Range_allocator &io_mem_alloc,
|
||||||
Range_allocator &,
|
Range_allocator &,
|
||||||
Rpc_entrypoint &ds_ep,
|
Rpc_entrypoint &ds_ep,
|
||||||
const char *args) :
|
const char *args)
|
||||||
|
:
|
||||||
_io_mem_alloc(io_mem_alloc),
|
_io_mem_alloc(io_mem_alloc),
|
||||||
_ds(0, 0, 0, UNCACHED, true, 0),
|
_ds(0, 0, 0, UNCACHED, true, 0),
|
||||||
_ds_ep(ds_ep),
|
_ds_ep(ds_ep),
|
||||||
_ds_cap(Io_mem_dataspace_capability())
|
_ds_cap(Io_mem_dataspace_capability())
|
||||||
{
|
{
|
||||||
warning("no io_mem support on Linux (args=\"", args, "\")"); }
|
warning("no io_mem support on Linux (args=\"", args, "\")");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Cache_attribute Io_mem_session_component::get_arg_wc(const char *)
|
Cache_attribute Io_mem_session_component::get_arg_wc(const char *)
|
||||||
{
|
{
|
||||||
@ -52,6 +59,7 @@ Cache_attribute Io_mem_session_component::get_arg_wc(const char *)
|
|||||||
return UNCACHED;
|
return UNCACHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Io_mem_dataspace_capability Io_mem_session_component::dataspace()
|
Io_mem_dataspace_capability Io_mem_session_component::dataspace()
|
||||||
{
|
{
|
||||||
return Io_mem_dataspace_capability();
|
return Io_mem_dataspace_capability();
|
||||||
|
@ -11,17 +11,18 @@
|
|||||||
* under the terms of the GNU Affero General Public License version 3.
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <util/string.h>
|
|
||||||
#include <util/arg_string.h>
|
|
||||||
#include <root/root.h>
|
|
||||||
#include <io_port_session_component.h>
|
#include <io_port_session_component.h>
|
||||||
|
|
||||||
|
using namespace Genode;
|
||||||
|
|
||||||
Genode::Io_port_session_component::Io_port_session_component(Genode::Range_allocator &io_port_alloc, const char *)
|
|
||||||
: _io_port_alloc(io_port_alloc)
|
Io_port_session_component::Io_port_session_component(Range_allocator &io_port_alloc,
|
||||||
|
const char *)
|
||||||
|
:
|
||||||
|
_io_port_alloc(io_port_alloc)
|
||||||
{
|
{
|
||||||
Genode::warning("IO PORTS are not supported on base linux");
|
warning("I/O port access is not supported on base linux");
|
||||||
}
|
}
|
||||||
|
|
||||||
Genode::Io_port_session_component::~Io_port_session_component()
|
|
||||||
{}
|
Io_port_session_component::~Io_port_session_component() { }
|
||||||
|
@ -13,68 +13,76 @@
|
|||||||
* under the terms of the GNU Affero General Public License version 3.
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Genode includes */
|
||||||
#include <base/log.h>
|
#include <base/log.h>
|
||||||
#include <base/thread.h>
|
#include <base/thread.h>
|
||||||
|
|
||||||
#include <irq_session_component.h>
|
#include <irq_session_component.h>
|
||||||
|
|
||||||
|
/* core-local includes */
|
||||||
#include <core_linux_syscalls.h>
|
#include <core_linux_syscalls.h>
|
||||||
|
|
||||||
Genode::Irq_session_component::Irq_session_component(Genode::Range_allocator &, const char *)
|
using namespace Genode;
|
||||||
|
|
||||||
|
|
||||||
|
Irq_session_component::Irq_session_component(Range_allocator &, const char *)
|
||||||
:
|
:
|
||||||
_irq_number(0),
|
_irq_number(0), _irq_object(_irq_number)
|
||||||
_irq_object(_irq_number)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
Genode::Irq_session_component::~Irq_session_component()
|
|
||||||
|
Irq_session_component::~Irq_session_component()
|
||||||
{
|
{
|
||||||
warning(__func__, " not implemented");
|
warning(__func__, " not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Genode::Irq_session_component::ack_irq()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void Genode::Irq_session_component::sigh(Genode::Signal_context_capability)
|
void Irq_session_component::ack_irq() { }
|
||||||
{ }
|
|
||||||
|
|
||||||
Genode::Irq_session::Info Genode::Irq_session_component::info()
|
|
||||||
|
void Irq_session_component::sigh(Signal_context_capability) { }
|
||||||
|
|
||||||
|
|
||||||
|
Irq_session::Info Irq_session_component::info()
|
||||||
{
|
{
|
||||||
return { .type = Genode::Irq_session::Info::Type::INVALID, .address = 0, .value = 0 };
|
return { .type = Irq_session::Info::Type::INVALID, .address = 0, .value = 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
Genode::Irq_object::Irq_object(unsigned irq) :
|
|
||||||
|
Irq_object::Irq_object(unsigned irq)
|
||||||
|
:
|
||||||
Thread_deprecated<4096>("irq"),
|
Thread_deprecated<4096>("irq"),
|
||||||
_sig_cap(Signal_context_capability()),
|
_sig_cap(Signal_context_capability()), _irq(irq), _fd(-1)
|
||||||
_irq(irq),
|
|
||||||
_fd(-1)
|
|
||||||
{
|
{
|
||||||
Genode::warning(__func__, " not implemented");
|
warning(__func__, " not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Genode::Irq_object::_associate()
|
|
||||||
|
bool Irq_object::_associate()
|
||||||
{
|
{
|
||||||
Genode::warning(__func__, " not implemented");
|
warning(__func__, " not implemented");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Genode::Irq_object::entry()
|
|
||||||
{
|
|
||||||
Genode::warning(__func__, " not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Genode::Irq_object::ack_irq()
|
void Irq_object::entry()
|
||||||
{
|
{
|
||||||
Genode::warning(__func__, " not implemented");
|
warning(__func__, " not implemented");
|
||||||
}
|
|
||||||
|
|
||||||
void Genode::Irq_object::start()
|
|
||||||
{
|
|
||||||
Genode::warning(__func__, " not implemented");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Genode::Irq_object::sigh(Signal_context_capability)
|
|
||||||
{
|
|
||||||
Genode::warning(__func__, " not implemented");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Irq_object::ack_irq()
|
||||||
|
{
|
||||||
|
warning(__func__, " not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Irq_object::start()
|
||||||
|
{
|
||||||
|
warning(__func__, " not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Irq_object::sigh(Signal_context_capability)
|
||||||
|
{
|
||||||
|
warning(__func__, " not implemented");
|
||||||
|
}
|
||||||
|
@ -16,22 +16,11 @@
|
|||||||
#include <base/service.h>
|
#include <base/service.h>
|
||||||
|
|
||||||
/* core includes */
|
/* core includes */
|
||||||
#include <core_env.h>
|
|
||||||
#include <platform.h>
|
|
||||||
#include <platform_services.h>
|
#include <platform_services.h>
|
||||||
#include <io_port_root.h>
|
|
||||||
|
|
||||||
#include <core_linux_syscalls.h>
|
|
||||||
|
|
||||||
/**
|
void Genode::platform_add_local_services(Rpc_entrypoint &,
|
||||||
* Add x86 specific ioport service
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Genode
|
|
||||||
{
|
|
||||||
void platform_add_local_services(Rpc_entrypoint &,
|
|
||||||
Sliced_heap &,
|
Sliced_heap &,
|
||||||
Registry<Service> &,
|
Registry<Service> &,
|
||||||
Trace::Source_registry &)
|
Trace::Source_registry &)
|
||||||
{ }
|
{ }
|
||||||
}
|
|
||||||
|
@ -61,15 +61,19 @@ Genode::size_t Dataspace_component::_file_size()
|
|||||||
|
|
||||||
|
|
||||||
Dataspace_component::Dataspace_component(const char *args)
|
Dataspace_component::Dataspace_component(const char *args)
|
||||||
: _fname(_file_name(args)),
|
:
|
||||||
|
_fname(_file_name(args)),
|
||||||
_size(_file_size()),
|
_size(_file_size()),
|
||||||
_addr(0),
|
_addr(0),
|
||||||
_cap(_fd_to_cap(lx_open(_fname.buf, O_RDONLY | LX_O_CLOEXEC, S_IRUSR | S_IXUSR))),
|
_cap(_fd_to_cap(lx_open(_fname.buf, O_RDONLY | LX_O_CLOEXEC, S_IRUSR | S_IXUSR))),
|
||||||
_writable(false),
|
_writable(false),
|
||||||
_owner(0) { }
|
_owner(0)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
|
||||||
Dataspace_component::Dataspace_component(size_t size, addr_t, addr_t phys_addr,
|
Dataspace_component::Dataspace_component(size_t size, addr_t, addr_t phys_addr,
|
||||||
Cache_attribute, bool writable, Dataspace_owner *_owner) :
|
Cache_attribute, bool writable, Dataspace_owner *_owner)
|
||||||
|
:
|
||||||
_size(size), _addr(phys_addr), _cap(), _writable(writable), _owner(_owner)
|
_size(size), _addr(phys_addr), _cap(), _writable(writable), _owner(_owner)
|
||||||
{
|
{
|
||||||
_fname.buf[0] = 0;
|
_fname.buf[0] = 0;
|
||||||
|
@ -11,17 +11,18 @@
|
|||||||
* under the terms of the GNU Affero General Public License version 3.
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Genode includes */
|
||||||
#include <base/log.h>
|
#include <base/log.h>
|
||||||
#include <linux_dataspace/client.h>
|
#include <linux_dataspace/client.h>
|
||||||
#include <base/internal/page_size.h>
|
#include <base/internal/page_size.h>
|
||||||
|
|
||||||
#include <core_linux_syscalls.h>
|
|
||||||
|
|
||||||
#include <io_mem_session_component.h>
|
#include <io_mem_session_component.h>
|
||||||
|
|
||||||
|
/* core-local includes */
|
||||||
|
#include <core_linux_syscalls.h>
|
||||||
|
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
|
|
||||||
size_t Io_mem_session_component::get_arg_size(const char *args)
|
size_t Io_mem_session_component::get_arg_size(const char *args)
|
||||||
{
|
{
|
||||||
size_t const size = Arg_string::find_arg(args, "size").ulong_value(0);
|
size_t const size = Arg_string::find_arg(args, "size").ulong_value(0);
|
||||||
@ -38,9 +39,10 @@ addr_t Io_mem_session_component::get_arg_phys(const char *args)
|
|||||||
return Arg_string::find_arg(args, "base").ulong_value(0);
|
return Arg_string::find_arg(args, "base").ulong_value(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Cache_attribute Io_mem_session_component::get_arg_wc(const char *args)
|
Cache_attribute Io_mem_session_component::get_arg_wc(const char *args)
|
||||||
{
|
{
|
||||||
Arg a = Arg_string::find_arg("wc", args);
|
Arg const a = Arg_string::find_arg("wc", args);
|
||||||
if (a.valid() && a.bool_value(0)) {
|
if (a.valid() && a.bool_value(0)) {
|
||||||
return WRITE_COMBINED;
|
return WRITE_COMBINED;
|
||||||
} else {
|
} else {
|
||||||
@ -58,10 +60,10 @@ Io_mem_session_component::Io_mem_session_component(Range_allocator &io_mem_alloc
|
|||||||
_ds_ep(ds_ep),
|
_ds_ep(ds_ep),
|
||||||
_ds_cap(Io_mem_dataspace_capability())
|
_ds_cap(Io_mem_dataspace_capability())
|
||||||
{
|
{
|
||||||
int _fd = -1;
|
int _fd = lx_open("/dev/hwio", O_RDWR | O_SYNC);
|
||||||
|
|
||||||
_fd = lx_open("/dev/hwio", O_RDWR | O_SYNC);
|
|
||||||
lx_ioctl_iomem(_fd, (unsigned long)get_arg_phys(args), get_arg_size(args));
|
lx_ioctl_iomem(_fd, (unsigned long)get_arg_phys(args), get_arg_size(args));
|
||||||
|
|
||||||
if (_fd > 0) {
|
if (_fd > 0) {
|
||||||
_ds.fd(_fd);
|
_ds.fd(_fd);
|
||||||
} else {
|
} else {
|
||||||
@ -72,6 +74,7 @@ Io_mem_session_component::Io_mem_session_component(Range_allocator &io_mem_alloc
|
|||||||
_ds_cap = static_cap_cast<Io_mem_dataspace>(static_cap_cast<Dataspace>(_ds_ep.manage(&_ds)));
|
_ds_cap = static_cap_cast<Io_mem_dataspace>(static_cap_cast<Dataspace>(_ds_ep.manage(&_ds)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Io_mem_dataspace_capability Io_mem_session_component::dataspace()
|
Io_mem_dataspace_capability Io_mem_session_component::dataspace()
|
||||||
{
|
{
|
||||||
return _ds_cap;
|
return _ds_cap;
|
||||||
|
@ -11,19 +11,20 @@
|
|||||||
* under the terms of the GNU Affero General Public License version 3.
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <util/string.h>
|
|
||||||
#include <util/arg_string.h>
|
#include <util/arg_string.h>
|
||||||
#include <root/root.h>
|
|
||||||
#include <io_port_session_component.h>
|
#include <io_port_session_component.h>
|
||||||
|
|
||||||
|
using namespace Genode;
|
||||||
|
|
||||||
Genode::Io_port_session_component::Io_port_session_component(Genode::Range_allocator &io_port_alloc, const char *args)
|
|
||||||
: _io_port_alloc(io_port_alloc)
|
Io_port_session_component::Io_port_session_component(Range_allocator &io_port_alloc,
|
||||||
|
const char *args)
|
||||||
|
:
|
||||||
|
_io_port_alloc(io_port_alloc)
|
||||||
{
|
{
|
||||||
/* parse for port properties */
|
/* parse for port properties */
|
||||||
_base = Arg_string::find_arg(args, "io_port_base").ulong_value(0);
|
_base = Arg_string::find_arg(args, "io_port_base").ulong_value(0);
|
||||||
_size = Arg_string::find_arg(args, "io_port_size").ulong_value(0);
|
_size = Arg_string::find_arg(args, "io_port_size").ulong_value(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Genode::Io_port_session_component::~Io_port_session_component()
|
Io_port_session_component::~Io_port_session_component() { }
|
||||||
{}
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
* \brief IRQ session implementation for base-linux
|
* \brief IRQ session implementation for base-linux
|
||||||
* \author Johannes Kliemann
|
* \author Johannes Kliemann
|
||||||
* \date 2018-03-14
|
* \date 2018-03-14
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -13,15 +12,19 @@
|
|||||||
* under the terms of the GNU Affero General Public License version 3.
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Genode includes */
|
||||||
#include <base/log.h>
|
#include <base/log.h>
|
||||||
#include <base/thread.h>
|
#include <base/thread.h>
|
||||||
|
|
||||||
|
/* core-local includes */
|
||||||
#include <irq_session_component.h>
|
#include <irq_session_component.h>
|
||||||
#include <irq_object.h>
|
#include <irq_object.h>
|
||||||
|
|
||||||
#include <core_linux_syscalls.h>
|
#include <core_linux_syscalls.h>
|
||||||
|
|
||||||
Genode::Irq_session_component::Irq_session_component(Genode::Range_allocator &, const char *args)
|
using namespace Genode;
|
||||||
|
|
||||||
|
|
||||||
|
Irq_session_component::Irq_session_component(Range_allocator &, const char *args)
|
||||||
:
|
:
|
||||||
_irq_number(Arg_string::find_arg(args, "irq_number").long_value(-1)),
|
_irq_number(Arg_string::find_arg(args, "irq_number").long_value(-1)),
|
||||||
_irq_object(_irq_number)
|
_irq_object(_irq_number)
|
||||||
@ -29,90 +32,93 @@ Genode::Irq_session_component::Irq_session_component(Genode::Range_allocator &,
|
|||||||
_irq_object.start();
|
_irq_object.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
Genode::Irq_session_component::~Irq_session_component()
|
|
||||||
|
Irq_session_component::~Irq_session_component()
|
||||||
{
|
{
|
||||||
warning(__func__, " not implemented");
|
warning(__func__, " not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Genode::Irq_session_component::ack_irq()
|
|
||||||
|
void Irq_session_component::ack_irq()
|
||||||
{
|
{
|
||||||
_irq_object.ack_irq();
|
_irq_object.ack_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Genode::Irq_session_component::sigh(Genode::Signal_context_capability cap)
|
|
||||||
|
void Irq_session_component::sigh(Signal_context_capability cap)
|
||||||
{
|
{
|
||||||
_irq_object.sigh(cap);
|
_irq_object.sigh(cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
Genode::Irq_session::Info Genode::Irq_session_component::info()
|
|
||||||
|
Irq_session::Info Irq_session_component::info()
|
||||||
{
|
{
|
||||||
return { .type = Genode::Irq_session::Info::Type::INVALID, .address = 0, .value = 0 };
|
return { .type = Irq_session::Info::Type::INVALID, .address = 0, .value = 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Genode::Irq_object::Irq_object(unsigned irq) :
|
Irq_object::Irq_object(unsigned irq)
|
||||||
|
:
|
||||||
Thread_deprecated<4096>("irq"),
|
Thread_deprecated<4096>("irq"),
|
||||||
_sig_cap(Signal_context_capability()),
|
_sig_cap(Signal_context_capability()), _irq(irq), _fd(-1)
|
||||||
_irq(irq),
|
|
||||||
_fd(-1)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
bool Genode::Irq_object::_associate()
|
|
||||||
|
bool Irq_object::_associate()
|
||||||
{
|
{
|
||||||
_fd = lx_open("/dev/hwio", O_RDWR | O_SYNC);
|
_fd = lx_open("/dev/hwio", O_RDWR | O_SYNC);
|
||||||
|
|
||||||
if (_fd < 0){
|
if (_fd < 0){
|
||||||
Genode::error("failed to open /dev/hwio");
|
error("failed to open /dev/hwio");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lx_ioctl_irq(_fd, _irq) < 0){
|
if (lx_ioctl_irq(_fd, _irq) < 0){
|
||||||
Genode::error("failed to request irq");
|
error("failed to request irq");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Genode::Irq_object::entry()
|
|
||||||
|
void Irq_object::entry()
|
||||||
{
|
{
|
||||||
if (!_associate()) {
|
if (!_associate())
|
||||||
error("failed to register IRQ ", _irq);
|
error("failed to register IRQ ", _irq);
|
||||||
}
|
|
||||||
|
|
||||||
_sync_bootup.wakeup();
|
_sync_bootup.wakeup();
|
||||||
_sync_ack.block();
|
_sync_ack.block();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
if (lx_read(_fd, 0, 0) < 0) {
|
if (lx_read(_fd, 0, 0) < 0)
|
||||||
Genode::warning("failed to read on /dev/hwio");
|
warning("failed to read on /dev/hwio");
|
||||||
}
|
|
||||||
|
|
||||||
if(!_sig_cap.valid()){
|
if(!_sig_cap.valid())
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
Genode::Signal_transmitter(_sig_cap).submit(1);
|
Signal_transmitter(_sig_cap).submit(1);
|
||||||
|
|
||||||
_sync_ack.block();
|
_sync_ack.block();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Genode::Irq_object::ack_irq()
|
|
||||||
|
void Irq_object::ack_irq()
|
||||||
{
|
{
|
||||||
_sync_ack.wakeup();
|
_sync_ack.wakeup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Genode::Irq_object::start()
|
|
||||||
|
void Irq_object::start()
|
||||||
{
|
{
|
||||||
Genode::Thread::start();
|
Thread::start();
|
||||||
_sync_bootup.block();
|
_sync_bootup.block();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Genode::Irq_object::sigh(Signal_context_capability cap)
|
|
||||||
|
void Irq_object::sigh(Signal_context_capability cap)
|
||||||
{
|
{
|
||||||
_sig_cap = cap;
|
_sig_cap = cap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,25 +20,19 @@
|
|||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <platform_services.h>
|
#include <platform_services.h>
|
||||||
#include <io_port_root.h>
|
#include <io_port_root.h>
|
||||||
|
|
||||||
#include <core_linux_syscalls.h>
|
#include <core_linux_syscalls.h>
|
||||||
|
|
||||||
/**
|
void Genode::platform_add_local_services(Rpc_entrypoint &,
|
||||||
* Add x86 specific ioport service
|
|
||||||
*/
|
|
||||||
namespace Genode
|
|
||||||
{
|
|
||||||
void platform_add_local_services(Rpc_entrypoint &,
|
|
||||||
Sliced_heap &md,
|
Sliced_heap &md,
|
||||||
Registry<Service> ®,
|
Registry<Service> ®,
|
||||||
Trace::Source_registry &)
|
Trace::Source_registry &)
|
||||||
{
|
{
|
||||||
if (!lx_iopl(3)) {
|
if (!lx_iopl(3)) {
|
||||||
static Io_port_root io_port_root(*core_env().pd_session(),
|
static Io_port_root io_port_root(*core_env().pd_session(),
|
||||||
platform().io_port_alloc(), md);
|
platform().io_port_alloc(), md);
|
||||||
|
|
||||||
static Core_service<Io_port_session_component>
|
static Core_service<Io_port_session_component>
|
||||||
|
|
||||||
io_port_ls(reg, io_port_root);
|
io_port_ls(reg, io_port_root);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -92,18 +92,16 @@ struct Stack_area_ram_allocator : Genode::Ram_allocator
|
|||||||
/**
|
/**
|
||||||
* Return single instance of the stack-area RM and RAM session
|
* Return single instance of the stack-area RM and RAM session
|
||||||
*/
|
*/
|
||||||
namespace Genode {
|
|
||||||
|
|
||||||
Region_map *env_stack_area_region_map;
|
Genode::Region_map *Genode::env_stack_area_region_map;
|
||||||
Ram_allocator *env_stack_area_ram_allocator;
|
Genode::Ram_allocator *Genode::env_stack_area_ram_allocator;
|
||||||
|
|
||||||
void init_stack_area()
|
void Genode::init_stack_area()
|
||||||
{
|
{
|
||||||
static Stack_area_region_map rm_inst;
|
static Stack_area_region_map rm_inst;
|
||||||
env_stack_area_region_map = &rm_inst;
|
env_stack_area_region_map = &rm_inst;
|
||||||
|
|
||||||
static Stack_area_ram_allocator ram_inst;
|
static Stack_area_ram_allocator ram_inst;
|
||||||
env_stack_area_ram_allocator = &ram_inst;
|
env_stack_area_ram_allocator = &ram_inst;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* \author Stefan Kalkowski
|
* \author Stefan Kalkowski
|
||||||
* \date 2011-05-22
|
* \date 2011-05-22
|
||||||
*
|
*
|
||||||
* A typed capability is a capability tied to one specifiec RPC interface
|
* A typed capability is a capability tied to one specifiec RPC interface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include <base/internal/expanding_parent_client.h>
|
#include <base/internal/expanding_parent_client.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
|
|
||||||
class Local_session;
|
class Local_session;
|
||||||
class Local_parent;
|
class Local_parent;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
namespace Genode { struct Native_thread; }
|
namespace Genode { struct Native_thread; }
|
||||||
|
|
||||||
|
|
||||||
class Genode::Native_thread
|
class Genode::Native_thread
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -37,6 +37,7 @@ class Genode::Region_map_mmap : public Region_map, public Dataspace
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
Region_registry _rmap { };
|
Region_registry _rmap { };
|
||||||
|
|
||||||
bool const _sub_rm; /* false if region map is root */
|
bool const _sub_rm; /* false if region map is root */
|
||||||
size_t const _size;
|
size_t const _size;
|
||||||
|
|
||||||
|
@ -19,10 +19,11 @@
|
|||||||
#include <base/rpc_client.h>
|
#include <base/rpc_client.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode { struct Linux_dataspace_client; }
|
||||||
|
|
||||||
struct Linux_dataspace_client : Rpc_client<Linux_dataspace>
|
|
||||||
{
|
struct Genode::Linux_dataspace_client : Rpc_client<Linux_dataspace>
|
||||||
|
{
|
||||||
explicit Linux_dataspace_client(Dataspace_capability ds)
|
explicit Linux_dataspace_client(Dataspace_capability ds)
|
||||||
: Rpc_client<Linux_dataspace>(static_cap_cast<Linux_dataspace>(ds)) { }
|
: Rpc_client<Linux_dataspace>(static_cap_cast<Linux_dataspace>(ds)) { }
|
||||||
|
|
||||||
@ -42,7 +43,6 @@ namespace Genode {
|
|||||||
|
|
||||||
Filename fname() override { return call<Rpc_fname>(); }
|
Filename fname() override { return call<Rpc_fname>(); }
|
||||||
Untyped_capability fd() override { return call<Rpc_fd>(); }
|
Untyped_capability fd() override { return call<Rpc_fd>(); }
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _INCLUDE__LINUX_DATASPACE__CLIENT_H_ */
|
#endif /* _INCLUDE__LINUX_DATASPACE__CLIENT_H_ */
|
||||||
|
@ -19,10 +19,11 @@
|
|||||||
#include <base/ipc.h>
|
#include <base/ipc.h>
|
||||||
#include <base/rpc.h>
|
#include <base/rpc.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode { struct Linux_dataspace; }
|
||||||
|
|
||||||
struct Linux_dataspace : Dataspace
|
|
||||||
{
|
struct Genode::Linux_dataspace : Dataspace
|
||||||
|
{
|
||||||
enum { FNAME_LEN = 64 };
|
enum { FNAME_LEN = 64 };
|
||||||
struct Filename { char buf[FNAME_LEN]; };
|
struct Filename { char buf[FNAME_LEN]; };
|
||||||
|
|
||||||
@ -49,7 +50,6 @@ namespace Genode {
|
|||||||
GENODE_RPC(Rpc_fname, Filename, fname);
|
GENODE_RPC(Rpc_fname, Filename, fname);
|
||||||
GENODE_RPC(Rpc_fd, Untyped_capability, fd);
|
GENODE_RPC(Rpc_fd, Untyped_capability, fd);
|
||||||
GENODE_RPC_INTERFACE_INHERIT(Dataspace, Rpc_fname, Rpc_fd);
|
GENODE_RPC_INTERFACE_INHERIT(Dataspace, Rpc_fname, Rpc_fd);
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _INCLUDE__LINUX_DATASPACE__LINUX_DATASPACE_H_ */
|
#endif /* _INCLUDE__LINUX_DATASPACE__LINUX_DATASPACE_H_ */
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
namespace Genode { struct Linux_native_cpu_client; }
|
namespace Genode { struct Linux_native_cpu_client; }
|
||||||
|
|
||||||
|
|
||||||
struct Genode::Linux_native_cpu_client : Rpc_client<Linux_native_cpu>
|
struct Genode::Linux_native_cpu_client : Rpc_client<Linux_native_cpu>
|
||||||
{
|
{
|
||||||
explicit Linux_native_cpu_client(Capability<Native_cpu> cap)
|
explicit Linux_native_cpu_client(Capability<Native_cpu> cap)
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
namespace Genode { struct Linux_native_pd_client; }
|
namespace Genode { struct Linux_native_pd_client; }
|
||||||
|
|
||||||
|
|
||||||
struct Genode::Linux_native_pd_client : Rpc_client<Linux_native_pd>
|
struct Genode::Linux_native_pd_client : Rpc_client<Linux_native_pd>
|
||||||
{
|
{
|
||||||
explicit Linux_native_pd_client(Capability<Native_pd> cap)
|
explicit Linux_native_pd_client(Capability<Native_pd> cap)
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include <linux_syscalls.h>
|
#include <linux_syscalls.h>
|
||||||
#include <base/internal/elf.h>
|
#include <base/internal/elf.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,10 +27,15 @@ using namespace Genode;
|
|||||||
extern char _binary_seccomp_bpf_policy_bin_start[];
|
extern char _binary_seccomp_bpf_policy_bin_start[];
|
||||||
extern char _binary_seccomp_bpf_policy_bin_end[];
|
extern char _binary_seccomp_bpf_policy_bin_end[];
|
||||||
|
|
||||||
struct bpf_program {
|
|
||||||
Genode::uint16_t blk_cnt;
|
namespace Genode {
|
||||||
Genode::uint64_t* blks;
|
|
||||||
};
|
struct Bpf_program
|
||||||
|
{
|
||||||
|
uint16_t blk_cnt;
|
||||||
|
uint64_t *blks;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
void Genode::binary_ready_hook_for_platform()
|
void Genode::binary_ready_hook_for_platform()
|
||||||
{
|
{
|
||||||
@ -40,19 +45,22 @@ void Genode::binary_ready_hook_for_platform()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (char* i = _binary_seccomp_bpf_policy_bin_start;
|
for (char* i = _binary_seccomp_bpf_policy_bin_start;
|
||||||
i < _binary_seccomp_bpf_policy_bin_end - sizeof(Genode::uint32_t); i++) {
|
i < _binary_seccomp_bpf_policy_bin_end - sizeof(uint32_t); i++) {
|
||||||
Genode::uint32_t* v = reinterpret_cast<Genode::uint32_t*>(i);
|
|
||||||
|
uint32_t *v = reinterpret_cast<uint32_t *>(i);
|
||||||
if (*v == 0xCAFEAFFE) {
|
if (*v == 0xCAFEAFFE) {
|
||||||
*v = lx_getpid();
|
*v = lx_getpid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bpf_program program;
|
Bpf_program program {
|
||||||
program.blk_cnt = (_binary_seccomp_bpf_policy_bin_end -
|
.blk_cnt = (uint16_t)((_binary_seccomp_bpf_policy_bin_end -
|
||||||
_binary_seccomp_bpf_policy_bin_start) /
|
_binary_seccomp_bpf_policy_bin_start) /
|
||||||
sizeof(Genode::uint64_t);
|
sizeof(uint64_t)),
|
||||||
program.blks = (Genode::uint64_t*)_binary_seccomp_bpf_policy_bin_start;
|
.blks = (uint64_t *)_binary_seccomp_bpf_policy_bin_start
|
||||||
Genode::uint64_t flags = SECCOMP_FILTER_FLAG_TSYNC;
|
};
|
||||||
|
|
||||||
|
uint64_t flags = SECCOMP_FILTER_FLAG_TSYNC;
|
||||||
auto ret = lx_seccomp(SECCOMP_SET_MODE_FILTER, flags, &program);
|
auto ret = lx_seccomp(SECCOMP_SET_MODE_FILTER, flags, &program);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
error("SECCOMP_SET_MODE_FILTER failed ", ret);
|
error("SECCOMP_SET_MODE_FILTER failed ", ret);
|
||||||
|
@ -19,8 +19,10 @@
|
|||||||
|
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
|
|
||||||
class Capability_invalid : public Genode::Exception {};
|
class Capability_invalid : public Genode::Exception {};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return pointer to locally implemented region map
|
* Return pointer to locally implemented region map
|
||||||
*
|
*
|
||||||
|
@ -79,10 +79,16 @@ static Genode::Env *_env_ptr;
|
|||||||
|
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
|
|
||||||
extern void bootstrap_component();
|
extern void bootstrap_component();
|
||||||
extern void call_global_static_constructors();
|
extern void call_global_static_constructors();
|
||||||
|
|
||||||
/*
|
struct Thread_meta_data_created;
|
||||||
|
struct Thread_meta_data_adopted;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
* This function is normally provided by the cxx library, which is not
|
* This function is normally provided by the cxx library, which is not
|
||||||
* used for lx_hybrid programs. For lx_hybrid programs, the exception
|
* used for lx_hybrid programs. For lx_hybrid programs, the exception
|
||||||
* handling is initialized by the host system's regular startup code.
|
* handling is initialized by the host system's regular startup code.
|
||||||
@ -90,26 +96,28 @@ namespace Genode {
|
|||||||
* However, we conveniently use this function to get hold of the
|
* However, we conveniently use this function to get hold of the
|
||||||
* component's environment and initialize the default log output.
|
* component's environment and initialize the default log output.
|
||||||
*/
|
*/
|
||||||
void init_exception_handling(Env &env)
|
void Genode::init_exception_handling(Env &env)
|
||||||
{
|
{
|
||||||
_env_ptr = &env;
|
_env_ptr = &env;
|
||||||
|
|
||||||
init_log(env.parent());
|
init_log(env.parent());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Static constructors are handled by the Linux startup code - so implement
|
* Static constructors are handled by the Linux startup code - so implement
|
||||||
* this as empty function.
|
* this as empty function.
|
||||||
*/
|
*/
|
||||||
void Genode::call_global_static_constructors() { }
|
void Genode::call_global_static_constructors() { }
|
||||||
|
|
||||||
|
|
||||||
Genode::size_t Component::stack_size() __attribute__((weak));
|
Genode::size_t Component::stack_size() __attribute__((weak));
|
||||||
Genode::size_t Component::stack_size()
|
Genode::size_t Component::stack_size()
|
||||||
{
|
{
|
||||||
return 16UL * 1024 * sizeof(Genode::addr_t);
|
return 16UL * 1024 * sizeof(Genode::addr_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hybrid components are not allowed to implement legacy main(). This enables
|
* Hybrid components are not allowed to implement legacy main(). This enables
|
||||||
* us to hook in and bootstrap components as usual.
|
* us to hook in and bootstrap components as usual.
|
||||||
@ -184,13 +192,11 @@ static pthread_key_t tls_key()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace Genode {
|
/**
|
||||||
|
|
||||||
/**
|
|
||||||
* Meta data tied to the thread via the pthread TLS mechanism
|
* Meta data tied to the thread via the pthread TLS mechanism
|
||||||
*/
|
*/
|
||||||
struct Native_thread::Meta_data
|
struct Genode::Native_thread::Meta_data
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Linux-specific thread meta data
|
* Linux-specific thread meta data
|
||||||
*
|
*
|
||||||
@ -241,13 +247,14 @@ namespace Genode {
|
|||||||
*/
|
*/
|
||||||
virtual void wait_for_join() = 0;
|
virtual void wait_for_join() = 0;
|
||||||
virtual void joined() = 0;
|
virtual void joined() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
|
/**
|
||||||
* Thread meta data for a thread created by Genode
|
* Thread meta data for a thread created by Genode
|
||||||
*/
|
*/
|
||||||
class Thread_meta_data_created : public Native_thread::Meta_data
|
class Genode::Thread_meta_data_created : public Native_thread::Meta_data
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -300,13 +307,14 @@ namespace Genode {
|
|||||||
{
|
{
|
||||||
_join_lock.wakeup();
|
_join_lock.wakeup();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
|
/**
|
||||||
* Thread meta data for an adopted thread
|
* Thread meta data for an adopted thread
|
||||||
*/
|
*/
|
||||||
class Thread_meta_data_adopted : public Native_thread::Meta_data
|
class Genode::Thread_meta_data_adopted : public Native_thread::Meta_data
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Thread_meta_data_adopted(Thread *thread)
|
Thread_meta_data_adopted(Thread *thread)
|
||||||
@ -341,8 +349,7 @@ namespace Genode {
|
|||||||
{
|
{
|
||||||
error("joined() called for an adopted thread");
|
error("joined() called for an adopted thread");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void adopt_thread(Native_thread::Meta_data *meta_data)
|
static void adopt_thread(Native_thread::Meta_data *meta_data)
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static Genode::Blockade *main_wait_lock()
|
static Genode::Blockade *main_wait_lock()
|
||||||
{
|
{
|
||||||
static Genode::Blockade inst;
|
static Genode::Blockade inst;
|
||||||
|
Reference in New Issue
Block a user