base,os: Coding-style unification

Fixes #1432
This commit is contained in:
Norman Feske 2015-03-04 21:12:14 +01:00 committed by Christian Helmuth
parent 56ed7addbc
commit e8336acafc
227 changed files with 19073 additions and 18833 deletions

View File

@ -21,11 +21,16 @@
namespace Genode { namespace Genode {
/** struct Cpu_state;
struct Cpu_state_modes;
}
/**
* Basic CPU state * Basic CPU state
*/ */
struct Cpu_state struct Genode::Cpu_state
{ {
/** /**
* Native exception types * Native exception types
*/ */
@ -49,13 +54,14 @@ namespace Genode {
addr_t ip; /* instruction pointer */ addr_t ip; /* instruction pointer */
addr_t cpsr; /* current program status register */ addr_t cpsr; /* current program status register */
addr_t cpu_exception; /* last hardware exception */ addr_t cpu_exception; /* last hardware exception */
}; };
/**
/**
* Extend CPU state by banked registers * Extend CPU state by banked registers
*/ */
struct Cpu_state_modes : Cpu_state struct Genode::Cpu_state_modes : Cpu_state
{ {
/** /**
* Common banked registers for exception modes * Common banked registers for exception modes
*/ */
@ -77,7 +83,6 @@ namespace Genode {
Mode_state mode[Mode_state::MAX]; /* exception mode registers */ Mode_state mode[Mode_state::MAX]; /* exception mode registers */
addr_t fiq_r[5]; /* fast-interrupt mode r8-r12 */ addr_t fiq_r[5]; /* fast-interrupt mode r8-r12 */
}; };
}
#endif /* _INCLUDE__ARM__CPU__CPU_STATE_H_ */ #endif /* _INCLUDE__ARM__CPU__CPU_STATE_H_ */

View File

@ -15,8 +15,8 @@
#ifndef _INCLUDE__ARM__CPU__STRING_H_ #ifndef _INCLUDE__ARM__CPU__STRING_H_
#define _INCLUDE__ARM__CPU__STRING_H_ #define _INCLUDE__ARM__CPU__STRING_H_
namespace Genode namespace Genode {
{
/** /**
* Copy memory block * Copy memory block
* *

View File

@ -16,8 +16,8 @@
#ifndef _INCLUDE__ARM__VFP__STRING_H_ #ifndef _INCLUDE__ARM__VFP__STRING_H_
#define _INCLUDE__ARM__VFP__STRING_H_ #define _INCLUDE__ARM__VFP__STRING_H_
namespace Genode namespace Genode {
{
/** /**
* Copy memory block * Copy memory block
* *

View File

@ -14,9 +14,10 @@
#ifndef _INCLUDE__BASE__AFFINITY_H_ #ifndef _INCLUDE__BASE__AFFINITY_H_
#define _INCLUDE__BASE__AFFINITY_H_ #define _INCLUDE__BASE__AFFINITY_H_
namespace Genode { namespace Genode { class Affinity; }
/**
/**
* Affinity to CPU nodes * Affinity to CPU nodes
* *
* The entity of CPU nodes is expected to form a grid where the Euclidean * The entity of CPU nodes is expected to form a grid where the Euclidean
@ -29,8 +30,8 @@ namespace Genode {
* by 'Affinity::Space'. The rectangle within the grid is represented by * by 'Affinity::Space'. The rectangle within the grid is represented by
* 'Affinity::Location'. * 'Affinity::Location'.
*/ */
class Affinity class Genode::Affinity
{ {
public: public:
class Location; class Location;
@ -179,13 +180,12 @@ namespace Genode {
max(scaled_x2 - scaled_x1, 1), max(scaled_x2 - scaled_x1, 1),
max(scaled_y2 - scaled_y1, 1)); max(scaled_y2 - scaled_y1, 1));
} }
}; };
Affinity::Location Affinity::Space::location_of_index(int index) Genode::Affinity::Location Genode::Affinity::Space::location_of_index(int index)
{ {
return Location(index % _width, (index / _width) % _height, 1, 1); return Location(index % _width, (index / _width) % _height, 1, 1);
}
} }
#endif /* _INCLUDE__BASE__AFFINITY_H_ */ #endif /* _INCLUDE__BASE__AFFINITY_H_ */

View File

@ -19,8 +19,33 @@
namespace Genode { namespace Genode {
struct Deallocator struct Deallocator;
{ struct Allocator;
struct Range_allocator;
/**
* Destroy object
*
* For destroying an object, we need to specify the allocator that was used
* by the object. Because we cannot pass the allocator directly to the
* delete expression, we mimic the expression by using this template
* function. The function explicitly calls the object destructor and
* operator delete afterwards.
*
* For details see https://github.com/genodelabs/genode/issues/1030.
*
* \param T implicit object type
*
* \param dealloc reference or pointer to allocator from which the object
* was allocated
* \param obj object to destroy
*/
template <typename T, typename DEALLOC> void destroy(DEALLOC && dealloc, T *obj);
}
struct Genode::Deallocator
{
/** /**
* Free block a previously allocated block * Free block a previously allocated block
*/ */
@ -40,11 +65,11 @@ namespace Genode {
* below for more details. * below for more details.
*/ */
virtual bool need_size_for_free() const = 0; virtual bool need_size_for_free() const = 0;
}; };
struct Allocator : Deallocator struct Genode::Allocator : Deallocator
{ {
/** /**
* Exception type * Exception type
*/ */
@ -111,11 +136,11 @@ namespace Genode {
return result; return result;
} }
}; };
struct Range_allocator : Allocator struct Genode::Range_allocator : Allocator
{ {
/** /**
* Destructor * Destructor
*/ */
@ -198,29 +223,9 @@ namespace Genode {
* otherwise * otherwise
*/ */
virtual bool valid_addr(addr_t addr) = 0; virtual bool valid_addr(addr_t addr) = 0;
}; };
/**
* Destroy object
*
* For destroying an object, we need to specify the allocator that was used
* by the object. Because we cannot pass the allocator directly to the
* delete expression, we mimic the expression by using this template
* function. The function explicitly calls the object destructor and
* operator delete afterwards.
*
* For details see https://github.com/genodelabs/genode/issues/1030.
*
* \param T implicit object type
*
* \param dealloc reference or pointer to allocator from which the object
* was allocated
* \param obj object to destroy
*/
template <typename T, typename DEALLOC> void destroy(DEALLOC && dealloc, T *obj);
}
void *operator new (Genode::size_t, Genode::Allocator *); void *operator new (Genode::size_t, Genode::Allocator *);
void *operator new [] (Genode::size_t, Genode::Allocator *); void *operator new [] (Genode::size_t, Genode::Allocator *);

View File

@ -25,8 +25,21 @@
namespace Genode { namespace Genode {
class Allocator_avl_base : public Range_allocator class Allocator_avl_base;
{
template <typename, unsigned SLAB_BLOCK_SIZE = 256*sizeof(addr_t)>
class Allocator_avl_tpl;
/**
* Define AVL-based allocator without any meta data attached to each block
*/
class Empty { };
typedef Allocator_avl_tpl<Empty> Allocator_avl;
}
class Genode::Allocator_avl_base : public Range_allocator
{
private: private:
static bool _sum_in_range(addr_t addr, addr_t offset) { static bool _sum_in_range(addr_t addr, addr_t offset) {
@ -256,17 +269,17 @@ namespace Genode {
size_t overhead(size_t) { return sizeof(Block) + sizeof(umword_t); } size_t overhead(size_t) { return sizeof(Block) + sizeof(umword_t); }
bool need_size_for_free() const override { return false; } bool need_size_for_free() const override { return false; }
}; };
/** /**
* AVL-based allocator with custom meta data attached to each block. * AVL-based allocator with custom meta data attached to each block.
* *
* \param BMDT block meta-data type * \param BMDT block meta-data type
*/ */
template <typename BMDT, unsigned SLAB_BLOCK_SIZE = 256 * sizeof(addr_t)> template <typename BMDT, unsigned SLAB_BLOCK_SIZE>
class Allocator_avl_tpl : public Allocator_avl_base class Genode::Allocator_avl_tpl : public Allocator_avl_base
{ {
protected: protected:
/* /*
@ -326,14 +339,6 @@ namespace Genode {
_metadata.backing_store(md_bs); _metadata.backing_store(md_bs);
return ret; return ret;
} }
}; };
/**
* Define AVL-based allocator without any meta data attached to each block
*/
class Empty { };
typedef Allocator_avl_tpl<Empty> Allocator_avl;
}
#endif /* _INCLUDE__BASE__ALLOCATOR_AVL_H_ */ #endif /* _INCLUDE__BASE__ALLOCATOR_AVL_H_ */

View File

@ -18,14 +18,15 @@
#include <base/printf.h> #include <base/printf.h>
#include <base/stdint.h> #include <base/stdint.h>
namespace Genode { namespace Genode { class Allocator_guard; }
/**
/**
* This class acts as guard for arbitrary allocators to limit * This class acts as guard for arbitrary allocators to limit
* memory exhaustion * memory exhaustion
*/ */
class Allocator_guard : public Allocator class Genode::Allocator_guard : public Allocator
{ {
private: private:
Allocator *_allocator; /* allocator to guard */ Allocator *_allocator; /* allocator to guard */
@ -67,7 +68,7 @@ namespace Genode {
* undefined in the error case * undefined in the error case
* \return true on success * \return true on success
*/ */
bool alloc(size_t size, void **out_addr) bool alloc(size_t size, void **out_addr) override
{ {
if ((_amount - _consumed) < (size + _allocator->overhead(size))) { if ((_amount - _consumed) < (size + _allocator->overhead(size))) {
PWRN("Quota exceeded! amount=%zu, size=%zu, consumed=%zu", PWRN("Quota exceeded! amount=%zu, size=%zu, consumed=%zu",
@ -83,7 +84,7 @@ namespace Genode {
/** /**
* Free block a previously allocated block * Free block a previously allocated block
*/ */
void free(void *addr, size_t size) void free(void *addr, size_t size) override
{ {
_allocator->free(addr, size); _allocator->free(addr, size);
_consumed -= size + _allocator->overhead(size); _consumed -= size + _allocator->overhead(size);
@ -92,7 +93,7 @@ namespace Genode {
/** /**
* Return amount of backing store consumed by the allocator * Return amount of backing store consumed by the allocator
*/ */
size_t consumed() { return _consumed; } size_t consumed() override { return _consumed; }
/** /**
* Return allocation limit * Return allocation limit
@ -102,11 +103,10 @@ namespace Genode {
/** /**
* Return meta-data overhead per block * Return meta-data overhead per block
*/ */
size_t overhead(size_t size) { return _allocator->overhead(size); } size_t overhead(size_t size) override { return _allocator->overhead(size); }
bool need_size_for_free() const override { bool need_size_for_free() const override {
return _allocator->need_size_for_free(); } return _allocator->need_size_for_free(); }
}; };
}
#endif /* _ALLOCATOR_GUARD_H_ */ #endif /* _ALLOCATOR_GUARD_H_ */

View File

@ -23,6 +23,8 @@
#include <base/exception.h> #include <base/exception.h>
namespace Genode { class Blocking_canceled : public Exception { }; } namespace Genode { class Blocking_canceled; }
class Genode::Blocking_canceled : public Exception { };
#endif /* _INCLUDE__BASE__BLOCKING_H_ */ #endif /* _INCLUDE__BASE__BLOCKING_H_ */

View File

@ -15,6 +15,8 @@
#define _INCLUDE__BASE__CACHE_H_ #define _INCLUDE__BASE__CACHE_H_
namespace Genode { namespace Genode {
enum Cache_attribute { UNCACHED, WRITE_COMBINED, CACHED }; enum Cache_attribute { UNCACHED, WRITE_COMBINED, CACHED };
} }
#endif /* _INCLUDE__BASE__CACHE_H_ */ #endif /* _INCLUDE__BASE__CACHE_H_ */

View File

@ -20,9 +20,12 @@
namespace Genode { namespace Genode {
class Thread_base; class Thread_base;
class Cancelable_lock;
}
class Cancelable_lock
{ class Genode::Cancelable_lock
{
private: private:
class Applicant class Applicant
@ -89,7 +92,6 @@ namespace Genode {
* Lock guard * Lock guard
*/ */
typedef Genode::Lock_guard<Cancelable_lock> Guard; typedef Genode::Lock_guard<Cancelable_lock> Guard;
}; };
}
#endif /* _INCLUDE__BASE__CANCELABLE_LOCK_H_ */ #endif /* _INCLUDE__BASE__CANCELABLE_LOCK_H_ */

View File

@ -33,15 +33,24 @@ namespace Genode {
*/ */
typedef Native_capability Untyped_capability; typedef Native_capability Untyped_capability;
template <typename> class Capability;
/** template <typename RPC_INTERFACE>
Capability<RPC_INTERFACE> reinterpret_cap_cast(Untyped_capability const &);
template <typename TO_RPC_INTERFACE, typename FROM_RPC_INTERFACE>
Capability<TO_RPC_INTERFACE> static_cap_cast(Capability<FROM_RPC_INTERFACE>);
}
/**
* Capability referring to a specific RPC interface * Capability referring to a specific RPC interface
* *
* \param RPC_INTERFACE class containing the RPC interface declaration * \param RPC_INTERFACE class containing the RPC interface declaration
*/ */
template <typename RPC_INTERFACE> template <typename RPC_INTERFACE>
class Capability : public Untyped_capability class Genode::Capability : public Untyped_capability
{ {
private: private:
/** /**
@ -294,38 +303,37 @@ namespace Genode {
_call<IF>(args, ret.value()); _call<IF>(args, ret.value());
return ret.value(); return ret.value();
} }
}; };
/** /**
* Convert an untyped capability to a typed capability * Convert an untyped capability to a typed capability
*/ */
template <typename RPC_INTERFACE> template <typename RPC_INTERFACE>
Capability<RPC_INTERFACE> Genode::Capability<RPC_INTERFACE>
reinterpret_cap_cast(Untyped_capability const &untyped_cap) Genode::reinterpret_cap_cast(Untyped_capability const &untyped_cap)
{ {
/* /*
* The object layout of untyped and typed capabilities is identical. * The object layout of untyped and typed capabilities is identical.
* Hence we can just use it's copy-constructors. * Hence we can just use it's copy-constructors.
*/ */
Untyped_capability *ptr = const_cast<Untyped_capability*>(&untyped_cap); Untyped_capability *ptr = const_cast<Untyped_capability*>(&untyped_cap);
return *static_cast<Capability<RPC_INTERFACE>*>(ptr); return *static_cast<Capability<RPC_INTERFACE>*>(ptr);
} }
/** /**
* Convert capability type from an interface base type to an inherited * Convert capability type from an interface base type to an inherited
* interface type * interface type
*/ */
template <typename TO_RPC_INTERFACE, typename FROM_RPC_INTERFACE> template <typename TO_RPC_INTERFACE, typename FROM_RPC_INTERFACE>
Capability<TO_RPC_INTERFACE> Genode::Capability<TO_RPC_INTERFACE>
static_cap_cast(Capability<FROM_RPC_INTERFACE> cap) Genode::static_cap_cast(Capability<FROM_RPC_INTERFACE> cap)
{ {
/* check interface compatibility */ /* check interface compatibility */
(void)static_cast<TO_RPC_INTERFACE *>((FROM_RPC_INTERFACE *)0); (void)static_cast<TO_RPC_INTERFACE *>((FROM_RPC_INTERFACE *)0);
return reinterpret_cap_cast<TO_RPC_INTERFACE>(cap); return reinterpret_cap_cast<TO_RPC_INTERFACE>(cap);
}
} }
#endif /* _INCLUDE__BASE__CAPABILITY_H_ */ #endif /* _INCLUDE__BASE__CAPABILITY_H_ */

View File

@ -24,7 +24,12 @@
namespace Genode { namespace Genode {
/** struct Child_policy;
struct Child;
}
/**
* Child policy interface * Child policy interface
* *
* A child-policy object is an argument to a 'Child'. It is responsible for * A child-policy object is an argument to a 'Child'. It is responsible for
@ -32,8 +37,8 @@ namespace Genode {
* it defines how session requests are resolved and how session arguments * it defines how session requests are resolved and how session arguments
* are passed to servers when creating sessions. * are passed to servers when creating sessions.
*/ */
struct Child_policy struct Genode::Child_policy
{ {
virtual ~Child_policy() { } virtual ~Child_policy() { }
/** /**
@ -125,10 +130,10 @@ namespace Genode {
* Take action on additional resource needs by the child * Take action on additional resource needs by the child
*/ */
virtual void resource_request(Parent::Resource_args const &) { } virtual void resource_request(Parent::Resource_args const &) { }
}; };
/** /**
* Implementation of the parent interface that supports resource trading * Implementation of the parent interface that supports resource trading
* *
* There are three possible cases of how a session can be provided to * There are three possible cases of how a session can be provided to
@ -153,8 +158,8 @@ namespace Genode {
* to our account, and subsequently transfer the same amount from our * to our account, and subsequently transfer the same amount from our
* account to the client. * account to the client.
*/ */
class Child : protected Rpc_object<Parent> class Genode::Child : protected Rpc_object<Parent>
{ {
private: private:
class Session; class Session;
@ -313,19 +318,18 @@ namespace Genode {
** Parent interface ** ** Parent interface **
**********************/ **********************/
void announce(Service_name const &, Root_capability); void announce(Service_name const &, Root_capability) override;
Session_capability session(Service_name const &, Session_args const &, Session_capability session(Service_name const &, Session_args const &,
Affinity const &); Affinity const &) override;
void upgrade(Session_capability, Upgrade_args const &); void upgrade(Session_capability, Upgrade_args const &) override;
void close(Session_capability); void close(Session_capability) override;
void exit(int); void exit(int) override;
Thread_capability main_thread_cap() const; Thread_capability main_thread_cap() const override;
void resource_avail_sigh(Signal_context_capability); void resource_avail_sigh(Signal_context_capability) override;
void resource_request(Resource_args const &); void resource_request(Resource_args const &) override;
void yield_sigh(Signal_context_capability); void yield_sigh(Signal_context_capability) override;
Resource_args yield_request(); Resource_args yield_request() override;
void yield_response(); void yield_response() override;
}; };
}
#endif /* _INCLUDE__BASE__CHILD_H_ */ #endif /* _INCLUDE__BASE__CHILD_H_ */

View File

@ -17,14 +17,15 @@
#include <base/env.h> #include <base/env.h>
#include <base/capability.h> #include <base/capability.h>
namespace Genode { namespace Genode { template <typename> class Connection; }
/**
/**
* Representation of an open connection to a service * Representation of an open connection to a service
*/ */
template <typename SESSION_TYPE> template <typename SESSION_TYPE>
class Connection : public Noncopyable class Genode::Connection : public Noncopyable
{ {
public: public:
enum On_destruction { CLOSE = false, KEEP_OPEN = true }; enum On_destruction { CLOSE = false, KEEP_OPEN = true };
@ -109,7 +110,6 @@ namespace Genode {
return _session(affinity, format_args, list); return _session(affinity, format_args, list);
} }
}; };
}
#endif /* _INCLUDE__BASE__CONNECTION_H_ */ #endif /* _INCLUDE__BASE__CONNECTION_H_ */

View File

@ -16,10 +16,11 @@
#include <stdarg.h> #include <stdarg.h>
namespace Genode { namespace Genode { class Console; }
class Console
{ class Genode::Console
{
public: public:
virtual ~Console() {} virtual ~Console() {}
@ -54,7 +55,6 @@ namespace Genode {
template <typename T> void _out_unsigned(T value, unsigned base = 10, int pad = 0); template <typename T> void _out_unsigned(T value, unsigned base = 10, int pad = 0);
template <typename T> void _out_signed(T value, unsigned base = 10); template <typename T> void _out_signed(T value, unsigned base = 10);
}; };
}
#endif /* _INCLUDE__BASE__CONSOLE_H_ */ #endif /* _INCLUDE__BASE__CONSOLE_H_ */

View File

@ -19,9 +19,12 @@
namespace Genode { namespace Genode {
class Elf_segment; class Elf_segment;
class Elf_binary;
}
class Elf_binary
{ class Genode::Elf_binary
{
public: public:
/** /**
@ -110,11 +113,11 @@ namespace Genode {
* Check for dynamic program segments * Check for dynamic program segments
*/ */
bool _dynamic_check_compat(unsigned type); bool _dynamic_check_compat(unsigned type);
}; };
class Elf_segment class Genode::Elf_segment
{ {
public: public:
/** /**
@ -151,7 +154,6 @@ namespace Genode {
size_t _file_size; size_t _file_size;
size_t _mem_size; size_t _mem_size;
Elf_binary::Flags _flags; Elf_binary::Flags _flags;
}; };
}
#endif /* _INCLUDE__BASE__ELF_H_ */ #endif /* _INCLUDE__BASE__ELF_H_ */

View File

@ -30,10 +30,22 @@
namespace Genode { namespace Genode {
class Env struct Env;
{
public:
extern Env *env();
/**
* Return parent capability
*
* Platforms have to implement this function for environment
* initialization.
*/
Parent_capability parent_cap();
}
struct Genode::Env
{
virtual ~Env() { } virtual ~Env() { }
/** /**
@ -73,17 +85,8 @@ namespace Genode {
* Heap backed by the ram_session of the environment. * Heap backed by the ram_session of the environment.
*/ */
virtual Allocator *heap() = 0; virtual Allocator *heap() = 0;
}; };
extern Env *env();
/**
* Return parent capability
*
* Platforms have to implement this function for environment
* initialization.
*/
Parent_capability parent_cap();
}
#endif /* _INCLUDE__BASE__ENV_H_ */ #endif /* _INCLUDE__BASE__ENV_H_ */

View File

@ -14,6 +14,8 @@
#ifndef _INCLUDE__BASE__EXCEPTION_H_ #ifndef _INCLUDE__BASE__EXCEPTION_H_
#define _INCLUDE__BASE__EXCEPTION_H_ #define _INCLUDE__BASE__EXCEPTION_H_
namespace Genode { class Exception { }; } namespace Genode { class Exception; }
class Genode::Exception { };
#endif /* _INCLUDE__BASE__EXCEPTION_H_ */ #endif /* _INCLUDE__BASE__EXCEPTION_H_ */

View File

@ -19,10 +19,13 @@
namespace Genode { namespace Genode {
class Flexpage struct Flexpage;
{ class Flexpage_iterator;
public: }
struct Genode::Flexpage
{
addr_t addr; addr_t addr;
addr_t hotspot; addr_t hotspot;
size_t log2_order; size_t log2_order;
@ -33,11 +36,11 @@ namespace Genode {
: addr(a), hotspot(h), log2_order(o) { } : addr(a), hotspot(h), log2_order(o) { }
bool valid() { return addr != ~0UL; } bool valid() { return addr != ~0UL; }
}; };
class Flexpage_iterator { class Genode::Flexpage_iterator
{
private: private:
addr_t _src_start, _src_size; addr_t _src_start, _src_size;
@ -61,7 +64,8 @@ namespace Genode {
Flexpage_iterator(addr_t src_start, size_t src_size, Flexpage_iterator(addr_t src_start, size_t src_size,
addr_t dst_start, size_t dst_size, addr_t dst_start, size_t dst_size,
addr_t hotspot) : addr_t hotspot)
:
_src_start(src_start), _src_size(src_size), _src_start(src_start), _src_size(src_size),
_dst_start(dst_start), _dst_size(dst_size), _dst_start(dst_start), _dst_size(dst_size),
_hotspot(hotspot), _offset(0) _hotspot(hotspot), _offset(0)
@ -107,7 +111,6 @@ namespace Genode {
return Flexpage(from_curr, _hotspot + _offset - (1UL << order), order); return Flexpage(from_curr, _hotspot + _offset - (1UL << order), order);
} }
}; };
}
#endif /* _INCLUDE__BASE__FLEX_ITERATOR_H */ #endif /* _INCLUDE__BASE__FLEX_ITERATOR_H */

View File

@ -22,14 +22,19 @@
namespace Genode { namespace Genode {
/** class Heap;
class Sliced_heap;
}
/**
* Heap that uses dataspaces as backing store * Heap that uses dataspaces as backing store
* *
* The heap class provides an allocator that uses a list of dataspaces of a ram * The heap class provides an allocator that uses a list of dataspaces of a ram
* session as backing store. One dataspace may be used for holding multiple blocks. * session as backing store. One dataspace may be used for holding multiple blocks.
*/ */
class Heap : public Allocator class Genode::Heap : public Allocator
{ {
private: private:
enum { enum {
@ -163,19 +168,19 @@ namespace Genode {
** Allocator interface ** ** Allocator interface **
*************************/ *************************/
bool alloc(size_t, void **); bool alloc(size_t, void **) override;
void free(void *, size_t); void free(void *, size_t) override;
size_t consumed() { return _quota_used; } size_t consumed() override { return _quota_used; }
size_t overhead(size_t size) { return _alloc.overhead(size); } size_t overhead(size_t size) override { return _alloc.overhead(size); }
bool need_size_for_free() const override { return false; } bool need_size_for_free() const override { return false; }
}; };
/** /**
* Heap that allocates each block at a separate dataspace * Heap that allocates each block at a separate dataspace
*/ */
class Sliced_heap : public Allocator class Genode::Sliced_heap : public Allocator
{ {
private: private:
class Block; class Block;
@ -208,7 +213,6 @@ namespace Genode {
size_t consumed() { return _consumed; } size_t consumed() { return _consumed; }
size_t overhead(size_t size); size_t overhead(size_t size);
bool need_size_for_free() const override { return false; } bool need_size_for_free() const override { return false; }
}; };
}
#endif /* _INCLUDE__BASE__HEAP_H_ */ #endif /* _INCLUDE__BASE__HEAP_H_ */

View File

@ -38,19 +38,27 @@ namespace Genode {
enum Ipc_server_reply { IPC_REPLY }; enum Ipc_server_reply { IPC_REPLY };
enum Ipc_server_reply_wait { IPC_REPLY_WAIT }; enum Ipc_server_reply_wait { IPC_REPLY_WAIT };
class Ipc_error;
/********************* class Ipc_marshaller;
** Exception types ** class Ipc_unmarshaller;
*********************/ class Ipc_ostream;
class Ipc_istream;
class Ipc_error : public Exception { }; class Ipc_client;
class Ipc_server;
}
/** /**
* Exception type
*/
class Genode::Ipc_error : public Exception { };
/**
* Marshal arguments into send message buffer * Marshal arguments into send message buffer
*/ */
class Ipc_marshaller class Genode::Ipc_marshaller
{ {
protected: protected:
char *_sndbuf; char *_sndbuf;
@ -118,14 +126,14 @@ namespace Genode {
Ipc_marshaller(char *sndbuf, size_t sndbuf_size) Ipc_marshaller(char *sndbuf, size_t sndbuf_size)
: _sndbuf(sndbuf), _sndbuf_size(sndbuf_size), _write_offset(0) { } : _sndbuf(sndbuf), _sndbuf_size(sndbuf_size), _write_offset(0) { }
}; };
/** /**
* Unmarshal arguments from receive buffer * Unmarshal arguments from receive buffer
*/ */
class Ipc_unmarshaller class Genode::Ipc_unmarshaller
{ {
protected: protected:
char *_rcvbuf; char *_rcvbuf;
@ -198,14 +206,14 @@ namespace Genode {
Ipc_unmarshaller(char *rcvbuf, size_t rcvbuf_size) Ipc_unmarshaller(char *rcvbuf, size_t rcvbuf_size)
: _rcvbuf(rcvbuf), _rcvbuf_size(rcvbuf_size), _read_offset(0) { } : _rcvbuf(rcvbuf), _rcvbuf_size(rcvbuf_size), _read_offset(0) { }
}; };
/** /**
* Stream for sending information via a capability to an endpoint * Stream for sending information via a capability to an endpoint
*/ */
class Ipc_ostream : public Ipc_marshaller class Genode::Ipc_ostream : public Ipc_marshaller
{ {
protected: protected:
Msgbuf_base *_snd_msg; /* send message buffer */ Msgbuf_base *_snd_msg; /* send message buffer */
@ -297,14 +305,14 @@ namespace Genode {
* Set destination for the next 'IPC_SEND' * Set destination for the next 'IPC_SEND'
*/ */
void dst(Native_capability const &dst) { _dst = dst; } void dst(Native_capability const &dst) { _dst = dst; }
}; };
/** /**
* Stream for receiving information * Stream for receiving information
*/ */
class Ipc_istream : public Ipc_unmarshaller, public Native_capability class Genode::Ipc_istream : public Ipc_unmarshaller, public Native_capability
{ {
private: private:
/** /**
@ -405,11 +413,11 @@ namespace Genode {
_unmarshal_capability(typed_cap); _unmarshal_capability(typed_cap);
return *this; return *this;
} }
}; };
class Ipc_client: public Ipc_istream, public Ipc_ostream class Genode::Ipc_client: public Ipc_istream, public Ipc_ostream
{ {
protected: protected:
int _result; /* result of most recent call */ int _result; /* result of most recent call */
@ -512,11 +520,11 @@ namespace Genode {
} }
int result() const { return _result; } int result() const { return _result; }
}; };
class Ipc_server : public Ipc_istream, public Ipc_ostream class Genode::Ipc_server : public Ipc_istream, public Ipc_ostream
{ {
protected: protected:
bool _reply_needed; /* false for the first reply_wait */ bool _reply_needed; /* false for the first reply_wait */
@ -624,7 +632,6 @@ namespace Genode {
_read_from_buf(value); _read_from_buf(value);
return *this; return *this;
} }
}; };
}
#endif /* _INCLUDE__BASE__IPC_GENERIC_H_ */ #endif /* _INCLUDE__BASE__IPC_GENERIC_H_ */

View File

@ -16,10 +16,11 @@
#include <base/cancelable_lock.h> #include <base/cancelable_lock.h>
namespace Genode { namespace Genode { class Lock; }
class Lock : public Cancelable_lock
{ class Genode::Lock : public Cancelable_lock
{
public: public:
/** /**
@ -41,7 +42,6 @@ namespace Genode {
* Lock guard * Lock guard
*/ */
typedef Lock_guard<Lock> Guard; typedef Lock_guard<Lock> Guard;
}; };
}
#endif /* _INCLUDE__BASE__LOCK_H_ */ #endif /* _INCLUDE__BASE__LOCK_H_ */

View File

@ -21,16 +21,17 @@
#ifndef _INCLUDE__BASE__LOCK_GUARD_H_ #ifndef _INCLUDE__BASE__LOCK_GUARD_H_
#define _INCLUDE__BASE__LOCK_GUARD_H_ #define _INCLUDE__BASE__LOCK_GUARD_H_
namespace Genode { namespace Genode { template <typename> class Lock_guard; }
/**
/**
* Lock guard template * Lock guard template
* *
* \param LT lock type * \param LT lock type
*/ */
template <typename LT> template <typename LT>
class Lock_guard class Genode::Lock_guard
{ {
private: private:
LT &_lock; LT &_lock;
@ -40,7 +41,6 @@ namespace Genode {
explicit Lock_guard(LT &lock) : _lock(lock) { _lock.lock(); } explicit Lock_guard(LT &lock) : _lock(lock) { _lock.lock(); }
~Lock_guard() { _lock.unlock(); } ~Lock_guard() { _lock.unlock(); }
}; };
}
#endif /* _INCLUDE__BASE__LOCK_GUARD_H_ */ #endif /* _INCLUDE__BASE__LOCK_GUARD_H_ */

View File

@ -18,9 +18,10 @@
#ifndef _INCLUDE__BASE__NATIVE_CAPABILITY_H_ #ifndef _INCLUDE__BASE__NATIVE_CAPABILITY_H_
#define _INCLUDE__BASE__NATIVE_CAPABILITY_H_ #define _INCLUDE__BASE__NATIVE_CAPABILITY_H_
namespace Genode { namespace Genode { template <typename> class Native_capability_tpl; }
/**
/**
* Generic parts of the platform-specific 'Native_capability' * Generic parts of the platform-specific 'Native_capability'
* *
* \param POLICY policy class that provides the type used as capability * \param POLICY policy class that provides the type used as capability
@ -40,9 +41,9 @@ namespace Genode {
* function returns true if the specified destination is valid. The * function returns true if the specified destination is valid. The
* 'invalid' function produces an invalid destination. * 'invalid' function produces an invalid destination.
*/ */
template <typename POLICY> template <typename POLICY>
class Native_capability_tpl class Genode::Native_capability_tpl
{ {
public: public:
typedef typename POLICY::Dst Dst; typedef typename POLICY::Dst Dst;
@ -112,8 +113,7 @@ namespace Genode {
* Return capability destination * Return capability destination
*/ */
Dst dst() const { return _dst; } Dst dst() const { return _dst; }
}; };
}
#endif /* _INCLUDE__BASE__NATIVE_CAPABILITY_H_ */ #endif /* _INCLUDE__BASE__NATIVE_CAPABILITY_H_ */

View File

@ -19,9 +19,10 @@
#include <base/capability.h> #include <base/capability.h>
#include <base/lock.h> #include <base/lock.h>
namespace Genode { namespace Genode { template <typename> class Object_pool; }
/**
/**
* Map object ids to local objects * Map object ids to local objects
* *
* \param OBJ_TYPE object type (must be inherited from Object_pool::Entry) * \param OBJ_TYPE object type (must be inherited from Object_pool::Entry)
@ -29,9 +30,9 @@ namespace Genode {
* The local names of a capabilities are used to differentiate multiple server * The local names of a capabilities are used to differentiate multiple server
* objects managed by one and the same object pool. * objects managed by one and the same object pool.
*/ */
template <typename OBJ_TYPE> template <typename OBJ_TYPE>
class Object_pool class Genode::Object_pool
{ {
public: public:
class Guard class Guard
@ -210,7 +211,6 @@ namespace Genode {
obj_typed->lock(); obj_typed->lock();
return obj_typed; return obj_typed;
} }
}; };
}
#endif /* _INCLUDE__BASE__OBJECT_POOL_H_ */ #endif /* _INCLUDE__BASE__OBJECT_POOL_H_ */

View File

@ -27,15 +27,23 @@
namespace Genode { namespace Genode {
/** class Pager_object;
class Pager_entrypoint;
class Pager_activation_base;
template <int> class Pager_activation;
}
/**
* Special server object for paging * Special server object for paging
* *
* A 'Pager_object' is very similar to a 'Rpc_object'. It is just a * A 'Pager_object' is very similar to a 'Rpc_object'. It is just a
* special implementation for page-fault handling, which does not allow to * special implementation for page-fault handling, which does not allow to
* define a "badge" for pager capabilities. * define a "badge" for pager capabilities.
*/ */
class Pager_object : public Object_pool<Pager_object>::Entry class Genode::Pager_object : public Object_pool<Pager_object>::Entry
{ {
protected: protected:
/** /**
@ -115,14 +123,14 @@ namespace Genode {
* fault occurred. * fault occurred.
*/ */
void unresolved_page_fault_occurred(); void unresolved_page_fault_occurred();
}; };
/**
/**
* A 'Pager_activation' processes one page fault of a 'Pager_object' at a time. * A 'Pager_activation' processes one page fault of a 'Pager_object' at a time.
*/ */
class Pager_entrypoint; class Genode::Pager_activation_base: public Thread_base
class Pager_activation_base: public Thread_base {
{
private: private:
Native_capability _cap; Native_capability _cap;
@ -164,17 +172,17 @@ namespace Genode {
_cap_valid.lock(); _cap_valid.lock();
return _cap; return _cap;
} }
}; };
/** /**
* Paging entry point * Paging entry point
* *
* For a paging entry point can hold only one activation. So, paging is * For a paging entry point can hold only one activation. So, paging is
* strictly serialized for one entry point. * strictly serialized for one entry point.
*/ */
class Pager_entrypoint : public Object_pool<Pager_object> class Genode::Pager_entrypoint : public Object_pool<Pager_object>
{ {
private: private:
Pager_activation_base *_activation; Pager_activation_base *_activation;
@ -201,17 +209,16 @@ namespace Genode {
* Dissolve Pager_object from entry point * Dissolve Pager_object from entry point
*/ */
void dissolve(Pager_object *obj); void dissolve(Pager_object *obj);
}; };
template <int STACK_SIZE> template <int STACK_SIZE>
class Pager_activation : public Pager_activation_base class Genode::Pager_activation : public Pager_activation_base
{ {
public: public:
Pager_activation() : Pager_activation_base("pager", STACK_SIZE) Pager_activation() : Pager_activation_base("pager", STACK_SIZE)
{ start(); } { start(); }
}; };
}
#endif /* _INCLUDE__BASE__PAGER_H_ */ #endif /* _INCLUDE__BASE__PAGER_H_ */

View File

@ -20,10 +20,11 @@
#include <cpu_session/client.h> #include <cpu_session/client.h>
#include <parent/capability.h> #include <parent/capability.h>
namespace Genode { namespace Genode { class Process; }
class Process
{ class Genode::Process
{
private: private:
Pd_connection _pd; Pd_connection _pd;
@ -89,7 +90,6 @@ namespace Genode {
Pd_session_capability pd_session_cap() const { return _pd.cap(); } Pd_session_capability pd_session_cap() const { return _pd.cap(); }
Thread_capability main_thread_cap() const { return _thread0_cap; } Thread_capability main_thread_cap() const { return _thread0_cap; }
}; };
}
#endif /* _INCLUDE__BASE__PROCESS_H_ */ #endif /* _INCLUDE__BASE__PROCESS_H_ */

View File

@ -19,11 +19,16 @@
namespace Genode { namespace Genode {
/** class Rpc_in_buffer_base;
template <size_t> class Rpc_in_buffer;
}
/**
* Base class of 'Rpc_in_buffer' * Base class of 'Rpc_in_buffer'
*/ */
class Rpc_in_buffer_base class Genode::Rpc_in_buffer_base
{ {
protected: protected:
const char *_base; const char *_base;
@ -50,15 +55,15 @@ namespace Genode {
const char *base() const { return _base; } const char *base() const { return _base; }
size_t size() const { return _size; } size_t size() const { return _size; }
}; };
/** /**
* Buffer with size constrain * Buffer with size constrain
*/ */
template <size_t MAX> template <Genode::size_t MAX>
class Rpc_in_buffer : public Rpc_in_buffer_base class Genode::Rpc_in_buffer : public Rpc_in_buffer_base
{ {
private: private:
/* /*
@ -115,7 +120,6 @@ namespace Genode {
* the function 'is_valid_string' can be used. * the function 'is_valid_string' can be used.
*/ */
char const *string() const { return is_valid_string() ? base() : ""; } char const *string() const { return is_valid_string() ? base() : ""; }
}; };
}
#endif /* _INCLUDE__BASE__RPC_ARGS_H_ */ #endif /* _INCLUDE__BASE__RPC_ARGS_H_ */

View File

@ -24,8 +24,14 @@
#include <cap_session/cap_session.h> #include <cap_session/cap_session.h>
namespace Genode { namespace Genode {
template <typename, typename> class Rpc_dispatcher;
class Rpc_object_base;
template <typename, typename> struct Rpc_object;
class Rpc_entrypoint;
}
/**
/**
* RPC dispatcher implementing the specified RPC interface * RPC dispatcher implementing the specified RPC interface
* *
* \param RPC_INTERFACE class providing the RPC interface description * \param RPC_INTERFACE class providing the RPC interface description
@ -42,9 +48,9 @@ namespace Genode {
* calls to the respective member functions of the 'SERVER' class and thereby * calls to the respective member functions of the 'SERVER' class and thereby
* omits virtual functions calls. * omits virtual functions calls.
*/ */
template <typename RPC_INTERFACE, typename SERVER = RPC_INTERFACE> template <typename RPC_INTERFACE, typename SERVER = RPC_INTERFACE>
class Rpc_dispatcher : public RPC_INTERFACE class Genode::Rpc_dispatcher : public RPC_INTERFACE
{ {
/** /**
* Shortcut for the type list of RPC functions provided by this server * Shortcut for the type list of RPC functions provided by this server
* component * component
@ -172,11 +178,11 @@ namespace Genode {
return _do_dispatch(opcode, is, os, return _do_dispatch(opcode, is, os,
Meta::Overload_selector<Rpc_functions>()); Meta::Overload_selector<Rpc_functions>());
} }
}; };
class Rpc_object_base : public Object_pool<Rpc_object_base>::Entry class Genode::Rpc_object_base : public Object_pool<Rpc_object_base>::Entry
{ {
public: public:
virtual ~Rpc_object_base() { } virtual ~Rpc_object_base() { }
@ -189,19 +195,19 @@ namespace Genode {
* \param os Ipc_output stream for storing method results * \param os Ipc_output stream for storing method results
*/ */
virtual int dispatch(int op, Ipc_istream &is, Ipc_ostream &os) = 0; virtual int dispatch(int op, Ipc_istream &is, Ipc_ostream &os) = 0;
}; };
/** /**
* Object that is accessible from remote protection domains * Object that is accessible from remote protection domains
* *
* A 'Rpc_object' is a locally implemented object that can be referenced * A 'Rpc_object' is a locally implemented object that can be referenced
* from the outer world using a capability. The capability gets created * from the outer world using a capability. The capability gets created
* when attaching a 'Rpc_object' to a 'Rpc_entrypoint'. * when attaching a 'Rpc_object' to a 'Rpc_entrypoint'.
*/ */
template <typename RPC_INTERFACE, typename SERVER = RPC_INTERFACE> template <typename RPC_INTERFACE, typename SERVER = RPC_INTERFACE>
struct Rpc_object : Rpc_object_base, Rpc_dispatcher<RPC_INTERFACE, SERVER> struct Genode::Rpc_object : Rpc_object_base, Rpc_dispatcher<RPC_INTERFACE, SERVER>
{ {
/***************************** /*****************************
** Server-object interface ** ** Server-object interface **
*****************************/ *****************************/
@ -215,10 +221,10 @@ namespace Genode {
{ {
return reinterpret_cap_cast<RPC_INTERFACE>(Rpc_object_base::cap()); return reinterpret_cap_cast<RPC_INTERFACE>(Rpc_object_base::cap());
} }
}; };
/** /**
* RPC entrypoint serving RPC objects * RPC entrypoint serving RPC objects
* *
* The entrypoint's thread will initialize its capability but will not * The entrypoint's thread will initialize its capability but will not
@ -230,8 +236,8 @@ namespace Genode {
* shortcut for the common case where the server's capability is handed * shortcut for the common case where the server's capability is handed
* over to other parties _after_ the server is completely initialized. * over to other parties _after_ the server is completely initialized.
*/ */
class Rpc_entrypoint : Thread_base, public Object_pool<Rpc_object_base> class Genode::Rpc_entrypoint : Thread_base, public Object_pool<Rpc_object_base>
{ {
private: private:
/** /**
@ -387,7 +393,6 @@ namespace Genode {
* Return true if the caller corresponds to the entrypoint called * Return true if the caller corresponds to the entrypoint called
*/ */
bool is_myself() const; bool is_myself() const;
}; };
}
#endif /* _INCLUDE__BASE__RPC_SERVER_H_ */ #endif /* _INCLUDE__BASE__RPC_SERVER_H_ */

View File

@ -21,13 +21,18 @@
namespace Genode { namespace Genode {
/** struct Semaphore_queue;
class Fifo_semaphore_queue;
template <typename, typename> class Semaphore_template;
}
/**
* Semaphore queue interface * Semaphore queue interface
*/ */
class Semaphore_queue struct Genode::Semaphore_queue
{ {
public:
/** /**
* Semaphore-queue elements * Semaphore-queue elements
* *
@ -56,14 +61,14 @@ namespace Genode {
* Dequeue queue member to wake up next * Dequeue queue member to wake up next
*/ */
Element *dequeue(); Element *dequeue();
}; };
/** /**
* First-in-first-out variant of the semaphore-queue interface * First-in-first-out variant of the semaphore-queue interface
*/ */
class Fifo_semaphore_queue : public Semaphore_queue class Genode::Fifo_semaphore_queue : public Semaphore_queue
{ {
public: public:
class Element : public Semaphore_queue::Element, class Element : public Semaphore_queue::Element,
@ -78,10 +83,10 @@ namespace Genode {
void enqueue(Element *e) { _fifo.enqueue(e); } void enqueue(Element *e) { _fifo.enqueue(e); }
Element *dequeue() { return _fifo.dequeue(); } Element *dequeue() { return _fifo.dequeue(); }
}; };
/** /**
* Semaphore base template * Semaphore base template
* *
* \param QT semaphore wait queue type implementing the * \param QT semaphore wait queue type implementing the
@ -93,9 +98,9 @@ namespace Genode {
* This way, the platform-specific semaphore-queueing policies * This way, the platform-specific semaphore-queueing policies
* such as priority-sorted queueing can be easily supported. * such as priority-sorted queueing can be easily supported.
*/ */
template <typename QT, typename QTE> template <typename QT, typename QTE>
class Semaphore_template class Genode::Semaphore_template
{ {
protected: protected:
int _cnt; int _cnt;
@ -163,9 +168,11 @@ namespace Genode {
* Return current semaphore counter * Return current semaphore counter
*/ */
int cnt() { return _cnt; } int cnt() { return _cnt; }
}; };
namespace Genode {
/** /**
* Semaphore with default behaviour * Semaphore with default behaviour
*/ */

View File

@ -22,15 +22,25 @@
namespace Genode { namespace Genode {
/** class Client;
class Server;
class Service;
class Local_service;
class Parent_service;
class Child_service;
class Service_registry;
}
/**
* Client role * Client role
* *
* A client is someone who applies for a service. If the service is not * A client is someone who applies for a service. If the service is not
* available yet, we enqueue the client into a wait queue and wake him up * available yet, we enqueue the client into a wait queue and wake him up
* as soon as the requested service gets available. * as soon as the requested service gets available.
*/ */
class Client : public List<Client>::Element class Genode::Client : public List<Client>::Element
{ {
private: private:
Cancelable_lock _service_apply_lock; Cancelable_lock _service_apply_lock;
@ -56,18 +66,18 @@ namespace Genode {
*/ */
void sleep() { _service_apply_lock.lock(); } void sleep() { _service_apply_lock.lock(); }
void wakeup() { _service_apply_lock.unlock(); } void wakeup() { _service_apply_lock.unlock(); }
}; };
/** /**
* Server role * Server role
* *
* A server is a process that provides one or multiple services. For the * A server is a process that provides one or multiple services. For the
* most part, this class is used as an opaque key to represent the server * most part, this class is used as an opaque key to represent the server
* role. * role.
*/ */
class Server class Genode::Server
{ {
private: private:
Ram_session_capability _ram; Ram_session_capability _ram;
@ -86,11 +96,11 @@ namespace Genode {
* Return RAM session capability of the server process * Return RAM session capability of the server process
*/ */
Ram_session_capability ram_session_cap() const { return _ram; } Ram_session_capability ram_session_cap() const { return _ram; }
}; };
class Service : public List<Service>::Element class Genode::Service : public List<Service>::Element
{ {
public: public:
enum { MAX_NAME_LEN = 32 }; enum { MAX_NAME_LEN = 32 };
@ -160,14 +170,14 @@ namespace Genode {
return server()->ram_session_cap(); return server()->ram_session_cap();
return Ram_session_capability(); return Ram_session_capability();
} }
}; };
/** /**
* Representation of a locally implemented service * Representation of a locally implemented service
*/ */
class Local_service : public Service class Genode::Local_service : public Service
{ {
private: private:
Root *_root; Root *_root;
@ -177,7 +187,7 @@ namespace Genode {
Local_service(const char *name, Root *root) Local_service(const char *name, Root *root)
: Service(name), _root(root) { } : Service(name), _root(root) { }
Session_capability session(const char *args, Affinity const &affinity) Session_capability session(const char *args, Affinity const &affinity) override
{ {
try { return _root->session(args, affinity); } try { return _root->session(args, affinity); }
catch (Root::Invalid_args) { throw Invalid_args(); } catch (Root::Invalid_args) { throw Invalid_args(); }
@ -186,30 +196,30 @@ namespace Genode {
catch (Genode::Ipc_error) { throw Unavailable(); } catch (Genode::Ipc_error) { throw Unavailable(); }
} }
void upgrade(Session_capability session, const char *args) void upgrade(Session_capability session, const char *args) override
{ {
try { _root->upgrade(session, args); } try { _root->upgrade(session, args); }
catch (Genode::Ipc_error) { throw Unavailable(); } catch (Genode::Ipc_error) { throw Unavailable(); }
} }
void close(Session_capability session) void close(Session_capability session) override
{ {
try { _root->close(session); } try { _root->close(session); }
catch (Genode::Ipc_error) { throw Blocking_canceled(); } catch (Genode::Ipc_error) { throw Blocking_canceled(); }
} }
}; };
/** /**
* Representation of a service provided by our parent * Representation of a service provided by our parent
*/ */
class Parent_service : public Service class Genode::Parent_service : public Service
{ {
public: public:
Parent_service(const char *name) : Service(name) { } Parent_service(const char *name) : Service(name) { }
Session_capability session(const char *args, Affinity const &affinity) Session_capability session(const char *args, Affinity const &affinity) override
{ {
try { return env()->parent()->session(name(), args, affinity); } try { return env()->parent()->session(name(), args, affinity); }
catch (Parent::Unavailable) { catch (Parent::Unavailable) {
@ -220,25 +230,25 @@ namespace Genode {
catch (Genode::Ipc_error) { throw Unavailable(); } catch (Genode::Ipc_error) { throw Unavailable(); }
} }
void upgrade(Session_capability session, const char *args) void upgrade(Session_capability session, const char *args) override
{ {
try { env()->parent()->upgrade(session, args); } try { env()->parent()->upgrade(session, args); }
catch (Genode::Ipc_error) { throw Unavailable(); } catch (Genode::Ipc_error) { throw Unavailable(); }
} }
void close(Session_capability session) void close(Session_capability session) override
{ {
try { env()->parent()->close(session); } try { env()->parent()->close(session); }
catch (Genode::Ipc_error) { throw Blocking_canceled(); } catch (Genode::Ipc_error) { throw Blocking_canceled(); }
} }
}; };
/** /**
* Representation of a service that is implemented in a child * Representation of a service that is implemented in a child
*/ */
class Child_service : public Service class Genode::Child_service : public Service
{ {
private: private:
Root_capability _root_cap; Root_capability _root_cap;
@ -259,9 +269,9 @@ namespace Genode {
Server *server) Server *server)
: Service(name), _root_cap(root), _root(root), _server(server) { } : Service(name), _root_cap(root), _root(root), _server(server) { }
Server *server() const { return _server; } Server *server() const override { return _server; }
Session_capability session(const char *args, Affinity const &affinity) Session_capability session(const char *args, Affinity const &affinity) override
{ {
if (!_root_cap.valid()) if (!_root_cap.valid())
throw Unavailable(); throw Unavailable();
@ -273,7 +283,7 @@ namespace Genode {
catch (Genode::Ipc_error) { throw Unavailable(); } catch (Genode::Ipc_error) { throw Unavailable(); }
} }
void upgrade(Session_capability sc, const char *args) void upgrade(Session_capability sc, const char *args) override
{ {
if (!_root_cap.valid()) if (!_root_cap.valid())
throw Unavailable(); throw Unavailable();
@ -285,19 +295,19 @@ namespace Genode {
catch (Genode::Ipc_error) { throw Unavailable(); } catch (Genode::Ipc_error) { throw Unavailable(); }
} }
void close(Session_capability sc) void close(Session_capability sc) override
{ {
try { _root.close(sc); } try { _root.close(sc); }
catch (Genode::Ipc_error) { throw Blocking_canceled(); } catch (Genode::Ipc_error) { throw Blocking_canceled(); }
} }
}; };
/** /**
* Container for holding service representations * Container for holding service representations
*/ */
class Service_registry class Genode::Service_registry
{ {
protected: protected:
Lock _service_wait_queue_lock; Lock _service_wait_queue_lock;
@ -439,7 +449,6 @@ namespace Genode {
while (_services.first()) while (_services.first())
remove(_services.first()); remove(_services.first());
} }
}; };
}
#endif /* _INCLUDE__BASE__SERVICE_H_ */ #endif /* _INCLUDE__BASE__SERVICE_H_ */

View File

@ -11,10 +11,12 @@
#include <base/stdint.h> #include <base/stdint.h>
namespace Genode { namespace Genode {
class Shared_object; class Shared_object;
struct Address_info; struct Address_info;
}; };
class Genode::Shared_object class Genode::Shared_object
{ {
private: private:

View File

@ -30,9 +30,14 @@ namespace Genode {
class Signal_receiver; class Signal_receiver;
class Signal_context; class Signal_context;
class Signal_context_registry; class Signal_context_registry;
class Signal_transmitter;
class Signal;
class Signal_dispatcher_base;
template <typename> class Signal_dispatcher;
}
/** /**
* Signal * Signal
* *
* A signal represents a number of asynchronous notifications produced by * A signal represents a number of asynchronous notifications produced by
@ -49,8 +54,8 @@ namespace Genode {
* can be used by the receiver to distinguish signals coming from different * can be used by the receiver to distinguish signals coming from different
* transmitters. * transmitters.
*/ */
class Signal class Genode::Signal
{ {
private: private:
struct Data struct Data
@ -99,11 +104,10 @@ namespace Genode {
Signal_context *context() { return _data.context; } Signal_context *context() { return _data.context; }
unsigned num() const { return _data.num; } unsigned num() const { return _data.num; }
}; };
/**
/**
* Signal transmitter * Signal transmitter
* *
* Each signal-transmitter instance acts on behalf the context specified * Each signal-transmitter instance acts on behalf the context specified
@ -111,8 +115,8 @@ namespace Genode {
* transmitter such as the consumed memory 'sizeof(Signal_transmitter)' * transmitter such as the consumed memory 'sizeof(Signal_transmitter)'
* should be accounted to the owner of the context. * should be accounted to the owner of the context.
*/ */
class Signal_transmitter class Genode::Signal_transmitter
{ {
private: private:
Signal_context_capability _context; /* destination */ Signal_context_capability _context; /* destination */
@ -145,14 +149,14 @@ namespace Genode {
* \param cnt number of signals to submit at once * \param cnt number of signals to submit at once
*/ */
void submit(unsigned cnt = 1); void submit(unsigned cnt = 1);
}; };
/** /**
* Signal receiver * Signal receiver
*/ */
class Signal_receiver : Noncopyable class Genode::Signal_receiver : Noncopyable
{ {
private: private:
/** /**
@ -249,10 +253,10 @@ namespace Genode {
* purposes. * purposes.
*/ */
static void dispatch_signals(Signal_source *signal_source); static void dispatch_signals(Signal_source *signal_source);
}; };
/** /**
* Signal context * Signal context
* *
* A signal context is a destination for signals. One receiver can listen * A signal context is a destination for signals. One receiver can listen
@ -260,8 +264,8 @@ namespace Genode {
* signel. This enables the receiver to distinguish different signal sources * signel. This enables the receiver to distinguish different signal sources
* and dispatch incoming signals context-specific. * and dispatch incoming signals context-specific.
*/ */
class Signal_context class Genode::Signal_context
{ {
private: private:
/** /**
@ -289,7 +293,6 @@ namespace Genode {
Lock _destroy_lock; /* prevent destruction while the Lock _destroy_lock; /* prevent destruction while the
context is in use */ context is in use */
/** /**
* Capability assigned to this context after being assocated with * Capability assigned to this context after being assocated with
* a 'Signal_receiver' via the 'manage' function. We store this * a 'Signal_receiver' via the 'manage' function. We store this
@ -336,19 +339,19 @@ namespace Genode {
* type for it but no real RPC interface. * type for it but no real RPC interface.
*/ */
GENODE_RPC_INTERFACE(); GENODE_RPC_INTERFACE();
}; };
/** /**
* Abstract interface to be implemented by signal dispatchers * Abstract interface to be implemented by signal dispatchers
*/ */
struct Signal_dispatcher_base : Signal_context struct Genode::Signal_dispatcher_base : Signal_context
{ {
virtual void dispatch(unsigned num) = 0; virtual void dispatch(unsigned num) = 0;
}; };
/** /**
* Adapter for directing signals to member functions * Adapter for directing signals to member functions
* *
* This utility associates member functions with signals. It is intended to * This utility associates member functions with signals. It is intended to
@ -360,10 +363,10 @@ namespace Genode {
* *
* \param T type of signal-handling class * \param T type of signal-handling class
*/ */
template <typename T> template <typename T>
class Signal_dispatcher : public Signal_dispatcher_base, class Genode::Signal_dispatcher : public Signal_dispatcher_base,
public Signal_context_capability public Signal_context_capability
{ {
private: private:
T &obj; T &obj;
@ -391,7 +394,6 @@ namespace Genode {
~Signal_dispatcher() { sig_rec.dissolve(this); } ~Signal_dispatcher() { sig_rec.dissolve(this); }
void dispatch(unsigned num) { (obj.*member)(num); } void dispatch(unsigned num) { (obj.*member)(num); }
}; };
}
#endif /* _INCLUDE__BASE__SIGNAL_H__ */ #endif /* _INCLUDE__BASE__SIGNAL_H__ */

View File

@ -20,14 +20,16 @@
namespace Genode { namespace Genode {
class Slab; class Slab;
class Slab_block;
class Slab_entry; class Slab_entry;
class Allocator; }
/**
/**
* A slab block holds an array of slab entries. * A slab block holds an array of slab entries.
*/ */
class Slab_block class Genode::Slab_block
{ {
public: public:
Slab_block *next; /* next block */ Slab_block *next; /* next block */
@ -115,11 +117,11 @@ namespace Genode {
*/ */
void dump(); void dump();
int check_bounds(); int check_bounds();
}; };
class Slab_entry class Genode::Slab_entry
{ {
private: private:
Slab_block *_sb; Slab_block *_sb;
@ -154,14 +156,14 @@ namespace Genode {
*/ */
static Slab_entry *slab_entry(void *addr) { static Slab_entry *slab_entry(void *addr) {
return (Slab_entry *)((addr_t)addr - sizeof(Slab_entry)); } return (Slab_entry *)((addr_t)addr - sizeof(Slab_entry)); }
}; };
/** /**
* Slab allocator * Slab allocator
*/ */
class Slab : public Allocator class Genode::Slab : public Allocator
{ {
private: private:
size_t _slab_size; /* size of one slab entry */ size_t _slab_size; /* size of one slab entry */
@ -252,7 +254,6 @@ namespace Genode {
size_t consumed(); size_t consumed();
size_t overhead(size_t) { return _block_size/_num_elem; } size_t overhead(size_t) { return _block_size/_num_elem; }
bool need_size_for_free() const override { return false; } bool need_size_for_free() const override { return false; }
}; };
}
#endif /* _INCLUDE__BASE__SLAB_H_ */ #endif /* _INCLUDE__BASE__SLAB_H_ */

View File

@ -19,8 +19,20 @@
namespace Genode { namespace Genode {
class String_console : public Console class String_console;
{
/**
* Print format string into character buffer
*
* \return number of characters written to destination buffer
*/
inline int snprintf(char *, size_t, const char *, ...)
__attribute__((format(printf, 3, 4)));
}
class Genode::String_console : public Console
{
private: private:
char *_dst; char *_dst;
@ -49,7 +61,7 @@ namespace Genode {
** Console interface ** ** Console interface **
***********************/ ***********************/
void _out_char(char c) void _out_char(char c) override
{ {
/* ensure to leave space for null-termination */ /* ensure to leave space for null-termination */
if (_w_offset + 2 > _dst_len) if (_w_offset + 2 > _dst_len)
@ -58,16 +70,11 @@ namespace Genode {
_dst[_w_offset++] = c; _dst[_w_offset++] = c;
_dst[_w_offset] = 0; _dst[_w_offset] = 0;
} }
}; };
/**
* Print format string into character buffer inline int Genode::snprintf(char *dst, size_t dst_len, const char *format, ...)
* {
* \return number of characters written to destination buffer
*/
inline int snprintf(char *, size_t, const char *, ...) __attribute__((format(printf, 3, 4)));
inline int snprintf(char *dst, size_t dst_len, const char *format, ...)
{
va_list list; va_list list;
va_start(list, format); va_start(list, format);
@ -76,7 +83,6 @@ namespace Genode {
va_end(list); va_end(list);
return sc.len(); return sc.len();
}
} }
#endif /* _INCLUDE__BASE__SNPRINTF_H_ */ #endif /* _INCLUDE__BASE__SNPRINTF_H_ */

View File

@ -19,7 +19,12 @@
namespace Genode { namespace Genode {
/** template <typename> class Synchronized_allocator;
template <typename> class Synchronized_range_allocator;
}
/**
* Lock-guarded allocator * Lock-guarded allocator
* *
* This class wraps the complete 'Allocator' interface while * This class wraps the complete 'Allocator' interface while
@ -28,9 +33,9 @@ namespace Genode {
* \param ALLOCATOR_IMPL class implementing the 'Allocator' * \param ALLOCATOR_IMPL class implementing the 'Allocator'
* interface * interface
*/ */
template <typename ALLOCATOR_IMPL> template <typename ALLOCATOR_IMPL>
class Synchronized_allocator : public Allocator class Genode::Synchronized_allocator : public Allocator
{ {
private: private:
Lock _default_lock; Lock _default_lock;
@ -69,25 +74,25 @@ namespace Genode {
** Allocator interface ** ** Allocator interface **
*************************/ *************************/
bool alloc(size_t size, void **out_addr) bool alloc(size_t size, void **out_addr) override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
return _alloc.alloc(size, out_addr); return _alloc.alloc(size, out_addr);
} }
void free(void *addr, size_t size) void free(void *addr, size_t size) override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
_alloc.free(addr, size); _alloc.free(addr, size);
} }
size_t consumed() size_t consumed() override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
return _alloc.consumed(); return _alloc.consumed();
} }
size_t overhead(size_t size) size_t overhead(size_t size) override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
return _alloc.overhead(size); return _alloc.overhead(size);
@ -98,9 +103,10 @@ namespace Genode {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
return _alloc.need_size_for_free(); return _alloc.need_size_for_free();
} }
}; };
/**
/**
* Lock-guarded range allocator * Lock-guarded range allocator
* *
* This class wraps the complete 'Range_allocator' interface while * This class wraps the complete 'Range_allocator' interface while
@ -109,9 +115,9 @@ namespace Genode {
* \param ALLOCATOR_IMPL class implementing the 'Range_allocator' * \param ALLOCATOR_IMPL class implementing the 'Range_allocator'
* interface * interface
*/ */
template <typename ALLOCATOR_IMPL> template <typename ALLOCATOR_IMPL>
class Synchronized_range_allocator : public Range_allocator class Genode::Synchronized_range_allocator : public Range_allocator
{ {
private: private:
Lock _default_lock; Lock _default_lock;
@ -173,25 +179,25 @@ namespace Genode {
** Allocator interface ** ** Allocator interface **
*************************/ *************************/
bool alloc(size_t size, void **out_addr) bool alloc(size_t size, void **out_addr) override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
return _alloc.alloc(size, out_addr); return _alloc.alloc(size, out_addr);
} }
void free(void *addr, size_t size) void free(void *addr, size_t size) override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
_alloc.free(addr, size); _alloc.free(addr, size);
} }
size_t consumed() size_t consumed() override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
return _alloc.consumed(); return _alloc.consumed();
} }
size_t overhead(size_t size) size_t overhead(size_t size) override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
return _alloc.overhead(size); return _alloc.overhead(size);
@ -208,48 +214,48 @@ namespace Genode {
** Range-allocator interface ** ** Range-allocator interface **
*******************************/ *******************************/
int add_range(addr_t base, size_t size) int add_range(addr_t base, size_t size) override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
return _alloc.add_range(base, size); return _alloc.add_range(base, size);
} }
int remove_range(addr_t base, size_t size) int remove_range(addr_t base, size_t size) override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
return _alloc.remove_range(base, size); return _alloc.remove_range(base, size);
} }
Alloc_return alloc_aligned(size_t size, void **out_addr, int align = 0, addr_t from = 0, addr_t to = ~0UL) Alloc_return alloc_aligned(size_t size, void **out_addr, int align = 0,
addr_t from = 0, addr_t to = ~0UL) override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
return _alloc.alloc_aligned(size, out_addr, align, from, to); return _alloc.alloc_aligned(size, out_addr, align, from, to);
} }
Alloc_return alloc_addr(size_t size, addr_t addr) Alloc_return alloc_addr(size_t size, addr_t addr) override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
return _alloc.alloc_addr(size, addr); return _alloc.alloc_addr(size, addr);
} }
void free(void *addr) void free(void *addr) override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
_alloc.free(addr); _alloc.free(addr);
} }
size_t avail() size_t avail() override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
return _alloc.avail(); return _alloc.avail();
} }
bool valid_addr(addr_t addr) bool valid_addr(addr_t addr) override
{ {
Lock::Guard lock_guard(*_lock); Lock::Guard lock_guard(*_lock);
return _alloc.valid_addr(addr); return _alloc.valid_addr(addr);
} }
}; };
}
#endif /* _INCLUDE__BASE__SYNC_ALLOCATOR_H_ */ #endif /* _INCLUDE__BASE__SYNC_ALLOCATOR_H_ */

View File

@ -9,23 +9,23 @@
* area, each thread has a fixed-sized slot, a thread context. The layout of * area, each thread has a fixed-sized slot, a thread context. The layout of
* each thread context looks as follows * each thread context looks as follows
* *
* ! lower address * ; lower address
* ! ... * ; ...
* ! ============================ <- aligned at the virtual context size * ; ============================ <- aligned at the virtual context size
* ! * ;
* ! empty * ; empty
* ! * ;
* ! ---------------------------- * ; ----------------------------
* ! * ;
* ! stack * ; stack
* ! (top) <- initial stack pointer * ; (top) <- initial stack pointer
* ! ---------------------------- <- address of 'Context' object * ; ---------------------------- <- address of 'Context' object
* ! additional context members * ; additional context members
* ! ---------------------------- * ; ----------------------------
* ! UTCB * ; UTCB
* ! ============================ <- aligned at the virtual context size * ; ============================ <- aligned at the virtual context size
* ! ... * ; ...
* ! higher address * ; higher address
* *
* On some platforms, a user-level thread-control block (UTCB) area contains * On some platforms, a user-level thread-control block (UTCB) area contains
* data shared between the user-level thread and the kernel. It is typically * data shared between the user-level thread and the kernel. It is typically
@ -69,15 +69,19 @@
namespace Genode { namespace Genode {
class Rm_session; class Rm_session;
class Thread_base;
template <unsigned> class Thread;
}
/**
/**
* Concurrent control flow * Concurrent control flow
* *
* A 'Thread_base' object corresponds to a physical thread. The execution * A 'Thread_base' object corresponds to a physical thread. The execution
* starts at the 'entry()' function as soon as 'start()' is called. * starts at the 'entry()' function as soon as 'start()' is called.
*/ */
class Thread_base class Genode::Thread_base
{ {
public: public:
class Context_alloc_failed : public Exception { }; class Context_alloc_failed : public Exception { };
@ -505,12 +509,12 @@ namespace Genode {
*/ */
template <typename EVENT> template <typename EVENT>
static void trace(EVENT const *event) { _logger()->log(event); } static void trace(EVENT const *event) { _logger()->log(event); }
}; };
template <unsigned STACK_SIZE> template <unsigned STACK_SIZE>
class Thread : public Thread_base class Genode::Thread : public Thread_base
{ {
public: public:
/** /**
@ -546,7 +550,6 @@ namespace Genode {
explicit Thread(const char *name, Cpu_session * cpu_session) explicit Thread(const char *name, Cpu_session * cpu_session)
: Thread_base(0, name, STACK_SIZE, Type::NORMAL, cpu_session) : Thread_base(0, name, STACK_SIZE, Type::NORMAL, cpu_session)
{ } { }
}; };
}
#endif /* _INCLUDE__BASE__THREAD_H_ */ #endif /* _INCLUDE__BASE__THREAD_H_ */

View File

@ -19,9 +19,8 @@
#include <base/thread_state_base.h> #include <base/thread_state_base.h>
namespace Genode { namespace Genode { struct Thread_state; }
struct Thread_state : Thread_state_base { }; struct Genode::Thread_state : Thread_state_base { };
}
#endif /* _INCLUDE__BASE__THREAD_STATE_H_ */ #endif /* _INCLUDE__BASE__THREAD_STATE_H_ */

View File

@ -18,14 +18,13 @@
#include <cpu/cpu_state.h> #include <cpu/cpu_state.h>
namespace Genode { namespace Genode { struct Thread_state_base; }
struct Thread_state_base : Cpu_state struct Genode::Thread_state_base : Cpu_state
{ {
bool unresolved_page_fault; bool unresolved_page_fault;
Thread_state_base() : unresolved_page_fault(false) { }; Thread_state_base() : unresolved_page_fault(false) { };
}; };
}
#endif /* _INCLUDE__BASE__THREAD_STATE_BASE_H_ */ #endif /* _INCLUDE__BASE__THREAD_STATE_BASE_H_ */

View File

@ -18,6 +18,7 @@
#include <base/trace/policy.h> #include <base/trace/policy.h>
namespace Genode { namespace Trace { namespace Genode { namespace Trace {
struct Rpc_call; struct Rpc_call;
struct Rpc_returned; struct Rpc_returned;
struct Rpc_dispatch; struct Rpc_dispatch;

View File

@ -16,20 +16,18 @@
#include <base/slab.h> #include <base/slab.h>
namespace Genode { namespace Genode { template <typename, size_t> struct Tslab; }
template <typename T, size_t BLOCK_SIZE>
class Tslab : public Slab
{
public:
template <typename T, Genode::size_t BLOCK_SIZE>
struct Genode::Tslab : Slab
{
Tslab(Allocator *backing_store, Tslab(Allocator *backing_store,
Slab_block *initial_sb = 0) Slab_block *initial_sb = 0)
: Slab(sizeof(T), BLOCK_SIZE, initial_sb, backing_store) : Slab(sizeof(T), BLOCK_SIZE, initial_sb, backing_store)
{ } { }
T *first_object() { return (T *)Slab::first_used_elem(); } T *first_object() { return (T *)Slab::first_used_elem(); }
}; };
}
#endif /* _INCLUDE__BASE__TSLAB_H_ */ #endif /* _INCLUDE__BASE__TSLAB_H_ */

View File

@ -21,10 +21,11 @@
#include <base/native_types.h> #include <base/native_types.h>
#include <session/session.h> #include <session/session.h>
namespace Genode { namespace Genode { struct Cap_session; }
struct Cap_session : Session
{ struct Genode::Cap_session : Session
{
static const char *service_name() { return "CAP"; } static const char *service_name() { return "CAP"; }
virtual ~Cap_session() { } virtual ~Cap_session() { }
@ -53,7 +54,6 @@ namespace Genode {
GENODE_RPC(Rpc_alloc, Native_capability, alloc, Native_capability); GENODE_RPC(Rpc_alloc, Native_capability, alloc, Native_capability);
GENODE_RPC(Rpc_free, void, free, Native_capability); GENODE_RPC(Rpc_free, void, free, Native_capability);
GENODE_RPC_INTERFACE(Rpc_alloc, Rpc_free); GENODE_RPC_INTERFACE(Rpc_alloc, Rpc_free);
}; };
}
#endif /* _INCLUDE__CAP_SESSION__CAP_SESSION_H_ */ #endif /* _INCLUDE__CAP_SESSION__CAP_SESSION_H_ */

View File

@ -18,18 +18,18 @@
#include <cap_session/cap_session.h> #include <cap_session/cap_session.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
namespace Genode { namespace Genode { struct Cap_session_client; }
struct Cap_session_client : Rpc_client<Cap_session>
{ struct Genode::Cap_session_client : Rpc_client<Cap_session>
{
explicit Cap_session_client(Cap_session_capability session) explicit Cap_session_client(Cap_session_capability session)
: Rpc_client<Cap_session>(session) { } : Rpc_client<Cap_session>(session) { }
Native_capability alloc(Native_capability ep) { Native_capability alloc(Native_capability ep) override {
return call<Rpc_alloc>(ep); } return call<Rpc_alloc>(ep); }
void free(Native_capability cap) { call<Rpc_free>(cap); } void free(Native_capability cap) override { call<Rpc_free>(cap); }
}; };
}
#endif /* _INCLUDE__CAP_SESSION__CLIENT_H_ */ #endif /* _INCLUDE__CAP_SESSION__CLIENT_H_ */

View File

@ -17,16 +17,16 @@
#include <cap_session/client.h> #include <cap_session/client.h>
#include <base/connection.h> #include <base/connection.h>
namespace Genode { namespace Genode { struct Cap_connection; }
struct Cap_connection : Connection<Cap_session>, Cap_session_client
{ struct Genode::Cap_connection : Connection<Cap_session>, Cap_session_client
{
Cap_connection() Cap_connection()
: :
Connection<Cap_session>(session("ram_quota=4K")), Connection<Cap_session>(session("ram_quota=4K")),
Cap_session_client(cap()) Cap_session_client(cap())
{ } { }
}; };
}
#endif /* _INCLUDE__CAP_SESSION__CONNECTION_H_ */ #endif /* _INCLUDE__CAP_SESSION__CONNECTION_H_ */

View File

@ -22,7 +22,6 @@ namespace Genode {
* Make D-Cache and I-Cache coherent * Make D-Cache and I-Cache coherent
*/ */
void cache_coherent(Genode::addr_t addr, Genode::size_t size); void cache_coherent(Genode::addr_t addr, Genode::size_t size);
} }
#endif /* _INCLUDE__CPU__CACHE_H_ */ #endif /* _INCLUDE__CPU__CACHE_H_ */

View File

@ -17,78 +17,78 @@
#include <cpu_session/capability.h> #include <cpu_session/capability.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
namespace Genode { namespace Genode { struct Cpu_session_client; }
struct Cpu_session_client : Rpc_client<Cpu_session>
{ struct Genode::Cpu_session_client : Rpc_client<Cpu_session>
{
explicit Cpu_session_client(Cpu_session_capability session) explicit Cpu_session_client(Cpu_session_capability session)
: Rpc_client<Cpu_session>(session) { } : Rpc_client<Cpu_session>(session) { }
Thread_capability Thread_capability
create_thread(size_t quota, Name const &name, addr_t utcb = 0) { create_thread(size_t quota, Name const &name, addr_t utcb = 0) override {
return call<Rpc_create_thread>(quota, name, utcb); } return call<Rpc_create_thread>(quota, name, utcb); }
Ram_dataspace_capability utcb(Thread_capability thread) { Ram_dataspace_capability utcb(Thread_capability thread) override {
return call<Rpc_utcb>(thread); } return call<Rpc_utcb>(thread); }
void kill_thread(Thread_capability thread) { void kill_thread(Thread_capability thread) override {
call<Rpc_kill_thread>(thread); } call<Rpc_kill_thread>(thread); }
int set_pager(Thread_capability thread, Pager_capability pager) { int set_pager(Thread_capability thread, Pager_capability pager) override {
return call<Rpc_set_pager>(thread, pager); } return call<Rpc_set_pager>(thread, pager); }
int start(Thread_capability thread, addr_t ip, addr_t sp) { int start(Thread_capability thread, addr_t ip, addr_t sp) override {
return call<Rpc_start>(thread, ip, sp); } return call<Rpc_start>(thread, ip, sp); }
void pause(Thread_capability thread) { void pause(Thread_capability thread) override {
call<Rpc_pause>(thread); } call<Rpc_pause>(thread); }
void resume(Thread_capability thread) { void resume(Thread_capability thread) override {
call<Rpc_resume>(thread); } call<Rpc_resume>(thread); }
void cancel_blocking(Thread_capability thread) { void cancel_blocking(Thread_capability thread) override {
call<Rpc_cancel_blocking>(thread); } call<Rpc_cancel_blocking>(thread); }
Thread_state state(Thread_capability thread) { Thread_state state(Thread_capability thread) override {
return call<Rpc_get_state>(thread); } return call<Rpc_get_state>(thread); }
void state(Thread_capability thread, Thread_state const &state) { void state(Thread_capability thread, Thread_state const &state) override {
call<Rpc_set_state>(thread, state); } call<Rpc_set_state>(thread, state); }
void exception_handler(Thread_capability thread, Signal_context_capability handler) { void exception_handler(Thread_capability thread, Signal_context_capability handler) override {
call<Rpc_exception_handler>(thread, handler); } call<Rpc_exception_handler>(thread, handler); }
void single_step(Thread_capability thread, bool enable) { void single_step(Thread_capability thread, bool enable) override {
call<Rpc_single_step>(thread, enable); } call<Rpc_single_step>(thread, enable); }
Affinity::Space affinity_space() const { Affinity::Space affinity_space() const override {
return call<Rpc_affinity_space>(); } return call<Rpc_affinity_space>(); }
void affinity(Thread_capability thread, Affinity::Location location) { void affinity(Thread_capability thread, Affinity::Location location) override {
call<Rpc_affinity>(thread, location); } call<Rpc_affinity>(thread, location); }
Dataspace_capability trace_control() { Dataspace_capability trace_control() override {
return call<Rpc_trace_control>(); } return call<Rpc_trace_control>(); }
unsigned trace_control_index(Thread_capability thread) { unsigned trace_control_index(Thread_capability thread) override {
return call<Rpc_trace_control_index>(thread); } return call<Rpc_trace_control_index>(thread); }
Dataspace_capability trace_buffer(Thread_capability thread) { Dataspace_capability trace_buffer(Thread_capability thread) override {
return call<Rpc_trace_buffer>(thread); } return call<Rpc_trace_buffer>(thread); }
Dataspace_capability trace_policy(Thread_capability thread) { Dataspace_capability trace_policy(Thread_capability thread) override {
return call<Rpc_trace_policy>(thread); } return call<Rpc_trace_policy>(thread); }
int ref_account(Cpu_session_capability session) { int ref_account(Cpu_session_capability session) override {
return call<Rpc_ref_account>(session); } return call<Rpc_ref_account>(session); }
int transfer_quota(Cpu_session_capability session, size_t amount) { int transfer_quota(Cpu_session_capability session, size_t amount) override {
return call<Rpc_transfer_quota>(session, amount); } return call<Rpc_transfer_quota>(session, amount); }
size_t quota() { return call<Rpc_quota>(); } size_t quota() override { return call<Rpc_quota>(); }
size_t used() { return call<Rpc_used>(); } size_t used() override { return call<Rpc_used>(); }
}; };
}
#endif /* _INCLUDE__CPU_SESSION__CLIENT_H_ */ #endif /* _INCLUDE__CPU_SESSION__CLIENT_H_ */

View File

@ -17,10 +17,11 @@
#include <cpu_session/client.h> #include <cpu_session/client.h>
#include <base/connection.h> #include <base/connection.h>
namespace Genode { namespace Genode { struct Cpu_connection; }
struct Cpu_connection : Connection<Cpu_session>, Cpu_session_client
{ struct Genode::Cpu_connection : Connection<Cpu_session>, Cpu_session_client
{
enum { RAM_QUOTA = 32*1024 }; enum { RAM_QUOTA = 32*1024 };
/** /**
@ -38,7 +39,6 @@ namespace Genode {
session(affinity, "priority=0x%lx, ram_quota=36K, label=\"%s\"", session(affinity, "priority=0x%lx, ram_quota=36K, label=\"%s\"",
priority, label)), priority, label)),
Cpu_session_client(cap()) { } Cpu_session_client(cap()) { }
}; };
}
#endif /* _INCLUDE__CPU_SESSION__CONNECTION_H_ */ #endif /* _INCLUDE__CPU_SESSION__CONNECTION_H_ */

View File

@ -2,21 +2,6 @@
* \brief CPU (processing time) manager session interface * \brief CPU (processing time) manager session interface
* \author Christian Helmuth * \author Christian Helmuth
* \date 2006-06-27 * \date 2006-06-27
*
* :Question:
*
* Why are thread operations not methods of the thread but
* methods of the CPU session?
*
* :Answer:
*
* This enables the CPU session to impose policies on thread
* operations. These policies are based on the session
* construction arguments. If thread operations would be
* provided as thread methods, Thread would need to consult
* its container object (its CPU session) about the authorization
* of each operation and, thereby, would introduce a circular
* dependency between CPU session and Thread.
*/ */
/* /*
@ -41,10 +26,11 @@
#include <session/session.h> #include <session/session.h>
#include <ram_session/ram_session.h> #include <ram_session/ram_session.h>
namespace Genode { namespace Genode { struct Cpu_session; }
struct Cpu_session : Session
{ struct Genode::Cpu_session : Session
{
/********************* /*********************
** Exception types ** ** Exception types **
*********************/ *********************/
@ -378,7 +364,6 @@ namespace Genode {
Meta::Type_tuple<Rpc_used, Meta::Type_tuple<Rpc_used,
Meta::Empty> Meta::Empty>
> > > > > > > > > > > > > > > > > > > > > Rpc_functions; > > > > > > > > > > > > > > > > > > > > > Rpc_functions;
}; };
}
#endif /* _INCLUDE__CPU_SESSION__CPU_SESSION_H_ */ #endif /* _INCLUDE__CPU_SESSION__CPU_SESSION_H_ */

View File

@ -17,17 +17,17 @@
#include <dataspace/capability.h> #include <dataspace/capability.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
namespace Genode { namespace Genode { struct Dataspace_client; }
struct Dataspace_client : Rpc_client<Dataspace>
{ struct Genode::Dataspace_client : Rpc_client<Dataspace>
{
explicit Dataspace_client(Dataspace_capability ds) explicit Dataspace_client(Dataspace_capability ds)
: Rpc_client<Dataspace>(ds) { } : Rpc_client<Dataspace>(ds) { }
size_t size() { return call<Rpc_size>(); } size_t size() override { return call<Rpc_size>(); }
addr_t phys_addr() { return call<Rpc_phys_addr>(); } addr_t phys_addr() override { return call<Rpc_phys_addr>(); }
bool writable() { return call<Rpc_writable>(); } bool writable() override { return call<Rpc_writable>(); }
}; };
}
#endif /* _INCLUDE__DATASPACE__CLIENT_H_ */ #endif /* _INCLUDE__DATASPACE__CLIENT_H_ */

View File

@ -17,10 +17,11 @@
#include <base/stdint.h> #include <base/stdint.h>
#include <base/rpc.h> #include <base/rpc.h>
namespace Genode { namespace Genode { struct Dataspace; }
struct Dataspace
{ struct Genode::Dataspace
{
virtual ~Dataspace() { } virtual ~Dataspace() { }
/** /**
@ -48,7 +49,6 @@ namespace Genode {
GENODE_RPC(Rpc_writable, bool, writable); GENODE_RPC(Rpc_writable, bool, writable);
GENODE_RPC_INTERFACE(Rpc_size, Rpc_phys_addr, Rpc_writable); GENODE_RPC_INTERFACE(Rpc_size, Rpc_phys_addr, Rpc_writable);
}; };
}
#endif /* _INCLUDE__DATASPACE__DATASPACE_H_ */ #endif /* _INCLUDE__DATASPACE__DATASPACE_H_ */

View File

@ -19,13 +19,14 @@
/* Genode includes */ /* Genode includes */
#include <util/mmio.h> #include <util/mmio.h>
namespace Genode namespace Genode { class Epit_base; }
{
/**
/**
* Core timer * Core timer
*/ */
class Epit_base : public Mmio class Genode::Epit_base : public Mmio
{ {
protected: protected:
enum { TICS_PER_MS = 32 }; enum { TICS_PER_MS = 32 };
@ -185,7 +186,6 @@ namespace Genode
{ {
return read<Sr::Ocif>() ? 0 : read<Cnt>(); return read<Sr::Ocif>() ? 0 : read<Cnt>();
} }
}; };
}
#endif /* _INCLUDE__DRIVERS__TIMER__EPIT_BASE_H_ */ #endif /* _INCLUDE__DRIVERS__TIMER__EPIT_BASE_H_ */

View File

@ -17,13 +17,14 @@
/* Genode includes */ /* Genode includes */
#include <util/mmio.h> #include <util/mmio.h>
namespace Genode namespace Genode { class Exynos_uart_base; }
{
/**
/**
* Exynos UART driver base * Exynos UART driver base
*/ */
class Exynos_uart_base : Mmio class Genode::Exynos_uart_base : Mmio
{ {
protected: protected:
/** /**
@ -239,8 +240,7 @@ namespace Genode
while (read<Ufstat::Tx_fifo_full>()) ; while (read<Ufstat::Tx_fifo_full>()) ;
write<Utxh::Transmit_data>(c); write<Utxh::Transmit_data>(c);
} }
}; };
}
#endif /* _INCLUDE__DRIVERS__UART__EXYNOS_UART_BASE_H_ */ #endif /* _INCLUDE__DRIVERS__UART__EXYNOS_UART_BASE_H_ */

View File

@ -18,13 +18,14 @@
/* Genode includes */ /* Genode includes */
#include <util/mmio.h> #include <util/mmio.h>
namespace Genode namespace Genode { class Imx_uart_base; }
{
/**
/**
* Driver base for i.MX UART-module * Driver base for i.MX UART-module
*/ */
class Imx_uart_base : Mmio class Genode::Imx_uart_base : Mmio
{ {
/** /**
* Control register 1 * Control register 1
*/ */
@ -267,8 +268,7 @@ namespace Genode
/* transmit character */ /* transmit character */
_put_char(c); _put_char(c);
} }
}; };
}
#endif /* _INCLUDE__DRIVERS__UART__IMX_UART_BASE_H_ */ #endif /* _INCLUDE__DRIVERS__UART__IMX_UART_BASE_H_ */

View File

@ -17,13 +17,14 @@
/* Genode includes */ /* Genode includes */
#include <util/mmio.h> #include <util/mmio.h>
namespace Genode namespace Genode { class Pl011_base; }
{
/**
/**
* Driver base for the PrimeCell UART PL011 Revision r1p3 * Driver base for the PrimeCell UART PL011 Revision r1p3
*/ */
class Pl011_base : Mmio class Genode::Pl011_base : Mmio
{ {
protected: protected:
enum { MAX_BAUD_RATE = 0xfffffff }; enum { MAX_BAUD_RATE = 0xfffffff };
@ -125,8 +126,7 @@ namespace Genode
* Send ASCII char 'c' over the UART interface * Send ASCII char 'c' over the UART interface
*/ */
inline void put_char(char const c); inline void put_char(char const c);
}; };
}
Genode::Pl011_base::Pl011_base(addr_t const base, uint32_t const clock, Genode::Pl011_base::Pl011_base(addr_t const base, uint32_t const clock,

View File

@ -17,16 +17,17 @@
/* Genode includes */ /* Genode includes */
#include <util/mmio.h> #include <util/mmio.h>
namespace Genode namespace Genode { class Tl16c750_base; }
{
/**
/**
* Base driver Texas instruments TL16C750 UART module * Base driver Texas instruments TL16C750 UART module
* *
* In contrast to the abilities of the TL16C750, this driver targets only * In contrast to the abilities of the TL16C750, this driver targets only
* the basic UART functionalities. * the basic UART functionalities.
*/ */
class Tl16c750_base : public Mmio class Genode::Tl16c750_base : public Mmio
{ {
protected: protected:
/** /**
* Least significant divisor part * Least significant divisor part
@ -240,8 +241,7 @@ namespace Genode
/* transmit character */ /* transmit character */
write<Uart_thr::Thr>(c); write<Uart_thr::Thr>(c);
} }
}; };
}
#endif /* _INCLUDE__DRIVERS__UART__TL16C750_BASE_H_ */ #endif /* _INCLUDE__DRIVERS__UART__TL16C750_BASE_H_ */

View File

@ -17,15 +17,15 @@
#include <io_mem_session/capability.h> #include <io_mem_session/capability.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
namespace Genode { namespace Genode { struct Io_mem_session_client; }
struct Io_mem_session_client : Rpc_client<Io_mem_session>
{ struct Genode::Io_mem_session_client : Rpc_client<Io_mem_session>
{
explicit Io_mem_session_client(Io_mem_session_capability session) explicit Io_mem_session_client(Io_mem_session_capability session)
: Rpc_client<Io_mem_session>(session) { } : Rpc_client<Io_mem_session>(session) { }
Io_mem_dataspace_capability dataspace() { return call<Rpc_dataspace>(); } Io_mem_dataspace_capability dataspace() override { return call<Rpc_dataspace>(); }
}; };
}
#endif /* _INCLUDE__IO_MEM_SESSION__CLIENT_H_ */ #endif /* _INCLUDE__IO_MEM_SESSION__CLIENT_H_ */

View File

@ -17,10 +17,11 @@
#include <io_mem_session/client.h> #include <io_mem_session/client.h>
#include <base/connection.h> #include <base/connection.h>
namespace Genode { namespace Genode { struct Io_mem_connection; }
struct Io_mem_connection : Connection<Io_mem_session>, Io_mem_session_client
{ struct Genode::Io_mem_connection : Connection<Io_mem_session>, Io_mem_session_client
{
/** /**
* Constructor * Constructor
* *
@ -36,7 +37,6 @@ namespace Genode {
Io_mem_session_client(cap()) Io_mem_session_client(cap())
{ } { }
}; };
}
#endif /* _INCLUDE__IO_MEM_SESSION__CONNECTION_H_ */ #endif /* _INCLUDE__IO_MEM_SESSION__CONNECTION_H_ */

View File

@ -19,12 +19,18 @@
namespace Genode { namespace Genode {
struct Io_mem_dataspace : Dataspace { }; struct Io_mem_dataspace;
struct Io_mem_session;
typedef Capability<Io_mem_dataspace> Io_mem_dataspace_capability; typedef Capability<Io_mem_dataspace> Io_mem_dataspace_capability;
}
struct Io_mem_session : Session
{ struct Genode::Io_mem_dataspace : Dataspace { };
struct Genode::Io_mem_session : Session
{
static const char *service_name() { return "IO_MEM"; } static const char *service_name() { return "IO_MEM"; }
virtual ~Io_mem_session() { } virtual ~Io_mem_session() { }
@ -43,9 +49,7 @@ namespace Genode {
*********************/ *********************/
GENODE_RPC(Rpc_dataspace, Io_mem_dataspace_capability, dataspace); GENODE_RPC(Rpc_dataspace, Io_mem_dataspace_capability, dataspace);
GENODE_RPC_INTERFACE(Rpc_dataspace); GENODE_RPC_INTERFACE(Rpc_dataspace);
}; };
}
#endif /* _INCLUDE__IO_MEM_SESSION__IO_MEM_SESSION_H_ */ #endif /* _INCLUDE__IO_MEM_SESSION__IO_MEM_SESSION_H_ */

View File

@ -17,31 +17,31 @@
#include <io_port_session/capability.h> #include <io_port_session/capability.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
namespace Genode { namespace Genode { struct Io_port_session_client; }
struct Io_port_session_client : Rpc_client<Io_port_session>
{ struct Genode::Io_port_session_client : Rpc_client<Io_port_session>
{
explicit Io_port_session_client(Io_port_session_capability session) explicit Io_port_session_client(Io_port_session_capability session)
: Rpc_client<Io_port_session>(session) { } : Rpc_client<Io_port_session>(session) { }
unsigned char inb(unsigned short address) { unsigned char inb(unsigned short address) override {
return call<Rpc_inb>(address); } return call<Rpc_inb>(address); }
unsigned short inw(unsigned short address) { unsigned short inw(unsigned short address) override {
return call<Rpc_inw>(address); } return call<Rpc_inw>(address); }
unsigned inl(unsigned short address) { unsigned inl(unsigned short address) override {
return call<Rpc_inl>(address); } return call<Rpc_inl>(address); }
void outb(unsigned short address, unsigned char value) { void outb(unsigned short address, unsigned char value) override {
call<Rpc_outb>(address, value); } call<Rpc_outb>(address, value); }
void outw(unsigned short address, unsigned short value) { void outw(unsigned short address, unsigned short value) override {
call<Rpc_outw>(address, value); } call<Rpc_outw>(address, value); }
void outl(unsigned short address, unsigned value) { void outl(unsigned short address, unsigned value) override {
call<Rpc_outl>(address, value); } call<Rpc_outl>(address, value); }
}; };
}
#endif /* _INCLUDE__IO_PORT_SESSION__CLIENT_H_ */ #endif /* _INCLUDE__IO_PORT_SESSION__CLIENT_H_ */

View File

@ -17,11 +17,12 @@
#include <io_port_session/client.h> #include <io_port_session/client.h>
#include <base/connection.h> #include <base/connection.h>
namespace Genode { namespace Genode { struct Io_port_connection; }
struct Io_port_connection : Connection<Io_port_session>,
struct Genode::Io_port_connection : Connection<Io_port_session>,
Io_port_session_client Io_port_session_client
{ {
/** /**
* Constructor * Constructor
* *
@ -36,7 +37,6 @@ namespace Genode {
Io_port_session_client(cap()) Io_port_session_client(cap())
{ } { }
}; };
}
#endif /* _INCLUDE__IO_PORT_SESSION__CONNECTION_H_ */ #endif /* _INCLUDE__IO_PORT_SESSION__CONNECTION_H_ */

View File

@ -28,10 +28,11 @@
#include <base/capability.h> #include <base/capability.h>
#include <session/session.h> #include <session/session.h>
namespace Genode { namespace Genode { struct Io_port_session; }
struct Io_port_session : Session
{ struct Genode::Io_port_session : Session
{
static const char *service_name() { return "IO_PORT"; } static const char *service_name() { return "IO_PORT"; }
virtual ~Io_port_session() { } virtual ~Io_port_session() { }
@ -110,7 +111,6 @@ namespace Genode {
GENODE_RPC(Rpc_outl, void, outl, unsigned short, unsigned); GENODE_RPC(Rpc_outl, void, outl, unsigned short, unsigned);
GENODE_RPC_INTERFACE(Rpc_inb, Rpc_inw, Rpc_inl, Rpc_outb, Rpc_outw, Rpc_outl); GENODE_RPC_INTERFACE(Rpc_inb, Rpc_inw, Rpc_inl, Rpc_outb, Rpc_outw, Rpc_outl);
}; };
}
#endif /* _INCLUDE__IO_PORT_SESSION__IO_PORT_SESSION_H_ */ #endif /* _INCLUDE__IO_PORT_SESSION__IO_PORT_SESSION_H_ */

View File

@ -17,15 +17,15 @@
#include <irq_session/capability.h> #include <irq_session/capability.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
namespace Genode { namespace Genode { struct Irq_session_client; }
struct Irq_session_client : Rpc_client<Irq_session>
{ struct Genode::Irq_session_client : Rpc_client<Irq_session>
{
explicit Irq_session_client(Irq_session_capability session) explicit Irq_session_client(Irq_session_capability session)
: Rpc_client<Irq_session>(session) { } : Rpc_client<Irq_session>(session) { }
void wait_for_irq() { call<Rpc_wait_for_irq>(); } void wait_for_irq() override { call<Rpc_wait_for_irq>(); }
}; };
}
#endif /* _INCLUDE__IRQ_SESSION__CLIENT_H_ */ #endif /* _INCLUDE__IRQ_SESSION__CLIENT_H_ */

View File

@ -17,10 +17,10 @@
#include <irq_session/client.h> #include <irq_session/client.h>
#include <base/connection.h> #include <base/connection.h>
namespace Genode { namespace Genode { struct Irq_connection; }
struct Irq_connection : Connection<Irq_session>, Irq_session_client struct Genode::Irq_connection : Connection<Irq_session>, Irq_session_client
{ {
/** /**
* Constructor * Constructor
* *
@ -37,7 +37,6 @@ namespace Genode {
irq, trigger, polarity)), irq, trigger, polarity)),
Irq_session_client(cap()) Irq_session_client(cap())
{ } { }
}; };
}
#endif /* _INCLUDE__IRQ_SESSION__CONNECTION_H_ */ #endif /* _INCLUDE__IRQ_SESSION__CONNECTION_H_ */

View File

@ -24,11 +24,11 @@
#include <base/capability.h> #include <base/capability.h>
#include <session/session.h> #include <session/session.h>
namespace Genode { namespace Genode { struct Irq_session; }
struct Irq_session : Session
{
struct Genode::Irq_session : Session
{
/** /**
* Interrupt trigger * Interrupt trigger
*/ */
@ -52,7 +52,6 @@ namespace Genode {
GENODE_RPC(Rpc_wait_for_irq, void, wait_for_irq); GENODE_RPC(Rpc_wait_for_irq, void, wait_for_irq);
GENODE_RPC_INTERFACE(Rpc_wait_for_irq); GENODE_RPC_INTERFACE(Rpc_wait_for_irq);
}; };
}
#endif /* _INCLUDE__IRQ_SESSION__IRQ_SESSION_H_ */ #endif /* _INCLUDE__IRQ_SESSION__IRQ_SESSION_H_ */

View File

@ -17,16 +17,16 @@
#include <log_session/capability.h> #include <log_session/capability.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
namespace Genode { namespace Genode { struct Log_session_client; }
struct Log_session_client : Rpc_client<Log_session>
{ struct Genode::Log_session_client : Rpc_client<Log_session>
{
explicit Log_session_client(Log_session_capability session) explicit Log_session_client(Log_session_capability session)
: Rpc_client<Log_session>(session) { } : Rpc_client<Log_session>(session) { }
size_t write(String const &string) { size_t write(String const &string) override {
return call<Rpc_write>(string); } return call<Rpc_write>(string); }
}; };
}
#endif /* _INCLUDE__LOG_SESSION__CLIENT_H_ */ #endif /* _INCLUDE__LOG_SESSION__CLIENT_H_ */

View File

@ -17,16 +17,16 @@
#include <log_session/client.h> #include <log_session/client.h>
#include <base/connection.h> #include <base/connection.h>
namespace Genode { namespace Genode { struct Log_connection; }
struct Log_connection : Connection<Log_session>, Log_session_client
{ struct Genode::Log_connection : Connection<Log_session>, Log_session_client
{
Log_connection() Log_connection()
: :
Connection<Log_session>(session("ram_quota=8K")), Connection<Log_session>(session("ram_quota=8K")),
Log_session_client(cap()) Log_session_client(cap())
{ } { }
}; };
}
#endif /* _INCLUDE__LOG_SESSION__CONNECTION_H_ */ #endif /* _INCLUDE__LOG_SESSION__CONNECTION_H_ */

View File

@ -19,10 +19,11 @@
#include <base/rpc_args.h> #include <base/rpc_args.h>
#include <session/session.h> #include <session/session.h>
namespace Genode { namespace Genode { struct Log_session; }
struct Log_session : Session
{ struct Genode::Log_session : Session
{
static const char *service_name() { return "LOG"; } static const char *service_name() { return "LOG"; }
virtual ~Log_session() { } virtual ~Log_session() { }
@ -43,7 +44,6 @@ namespace Genode {
GENODE_RPC(Rpc_write, size_t, write, String const &); GENODE_RPC(Rpc_write, size_t, write, String const &);
GENODE_RPC_INTERFACE(Rpc_write); GENODE_RPC_INTERFACE(Rpc_write);
}; };
}
#endif /* _INCLUDE__LOG_SESSION__LOG_SESSION_H_ */ #endif /* _INCLUDE__LOG_SESSION__LOG_SESSION_H_ */

View File

@ -17,44 +17,44 @@
#include <parent/capability.h> #include <parent/capability.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
namespace Genode { namespace Genode { struct Parent_client; }
struct Parent_client : Rpc_client<Parent>
{ struct Genode::Parent_client : Rpc_client<Parent>
{
explicit Parent_client(Parent_capability parent) explicit Parent_client(Parent_capability parent)
: Rpc_client<Parent>(parent) { } : Rpc_client<Parent>(parent) { }
void exit(int exit_value) { call<Rpc_exit>(exit_value); } void exit(int exit_value) override { call<Rpc_exit>(exit_value); }
void announce(Service_name const &service, Root_capability root) { void announce(Service_name const &service, Root_capability root) override {
call<Rpc_announce>(service, root); } call<Rpc_announce>(service, root); }
Session_capability session(Service_name const &service, Session_capability session(Service_name const &service,
Session_args const &args, Session_args const &args,
Affinity const &affinity) { Affinity const &affinity) override {
return call<Rpc_session>(service, args, affinity); } return call<Rpc_session>(service, args, affinity); }
void upgrade(Session_capability to_session, Upgrade_args const &args) { void upgrade(Session_capability to_session, Upgrade_args const &args) override {
call<Rpc_upgrade>(to_session, args); } call<Rpc_upgrade>(to_session, args); }
void close(Session_capability session) { call<Rpc_close>(session); } void close(Session_capability session) override { call<Rpc_close>(session); }
Thread_capability main_thread_cap() const { Thread_capability main_thread_cap() const override {
return call<Rpc_main_thread>(); } return call<Rpc_main_thread>(); }
void resource_avail_sigh(Signal_context_capability sigh) { void resource_avail_sigh(Signal_context_capability sigh) override {
call<Rpc_resource_avail_sigh>(sigh); } call<Rpc_resource_avail_sigh>(sigh); }
void resource_request(Resource_args const &args) { void resource_request(Resource_args const &args) override {
call<Rpc_resource_request>(args); } call<Rpc_resource_request>(args); }
void yield_sigh(Signal_context_capability sigh) { void yield_sigh(Signal_context_capability sigh) override {
call<Rpc_yield_sigh>(sigh); } call<Rpc_yield_sigh>(sigh); }
Resource_args yield_request() { return call<Rpc_yield_request>(); } Resource_args yield_request() override { return call<Rpc_yield_request>(); }
void yield_response() { call<Rpc_yield_response>(); } void yield_response() override { call<Rpc_yield_response>(); }
}; };
}
#endif /* _INCLUDE__PARENT__CLIENT_H_ */ #endif /* _INCLUDE__PARENT__CLIENT_H_ */

View File

@ -21,10 +21,11 @@
#include <session/capability.h> #include <session/capability.h>
#include <root/capability.h> #include <root/capability.h>
namespace Genode { namespace Genode { class Parent; }
class Parent
{ class Genode::Parent
{
private: private:
/** /**
@ -262,8 +263,7 @@ namespace Genode {
Meta::Type_tuple<Rpc_yield_response, Meta::Type_tuple<Rpc_yield_response,
Meta::Empty> Meta::Empty>
> > > > > > > > > > Rpc_functions; > > > > > > > > > > Rpc_functions;
}; };
}
template <typename ROOT_INTERFACE> template <typename ROOT_INTERFACE>

View File

@ -17,21 +17,21 @@
#include <pd_session/capability.h> #include <pd_session/capability.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
namespace Genode { namespace Genode { struct Pd_session_client; }
struct Pd_session_client : Rpc_client<Pd_session>
{ struct Genode::Pd_session_client : Rpc_client<Pd_session>
{
explicit Pd_session_client(Pd_session_capability session) explicit Pd_session_client(Pd_session_capability session)
: Rpc_client<Pd_session>(session) { } : Rpc_client<Pd_session>(session) { }
int bind_thread(Thread_capability thread) { int bind_thread(Thread_capability thread) override {
return call<Rpc_bind_thread>(thread); } return call<Rpc_bind_thread>(thread); }
int assign_parent(Parent_capability parent) { int assign_parent(Parent_capability parent) override {
return call<Rpc_assign_parent>(parent); } return call<Rpc_assign_parent>(parent); }
bool assign_pci(addr_t) { return false; } bool assign_pci(addr_t) { return false; }
}; };
}
#endif /* _INCLUDE__PD_SESSION__CLIENT_H_ */ #endif /* _INCLUDE__PD_SESSION__CLIENT_H_ */

View File

@ -17,10 +17,11 @@
#include <pd_session/client.h> #include <pd_session/client.h>
#include <base/connection.h> #include <base/connection.h>
namespace Genode { namespace Genode { struct Pd_connection; }
struct Pd_connection : Connection<Pd_session>, Pd_session_client
{ struct Genode::Pd_connection : Connection<Pd_session>, Pd_session_client
{
/** /**
* Constructor * Constructor
* *
@ -31,7 +32,6 @@ namespace Genode {
Connection<Pd_session>(session("ram_quota=4K, label=\"%s\"", label)), Connection<Pd_session>(session("ram_quota=4K, label=\"%s\"", label)),
Pd_session_client(cap()) Pd_session_client(cap())
{ } { }
}; };
}
#endif /* _INCLUDE__PD_SESSION__CONNECTION_H_ */ #endif /* _INCLUDE__PD_SESSION__CONNECTION_H_ */

View File

@ -20,10 +20,11 @@
#include <parent/capability.h> #include <parent/capability.h>
#include <session/session.h> #include <session/session.h>
namespace Genode { namespace Genode { struct Pd_session; }
struct Pd_session : Session
{ struct Genode::Pd_session : Session
{
static const char *service_name() { return "PD"; } static const char *service_name() { return "PD"; }
virtual ~Pd_session() { } virtual ~Pd_session() { }
@ -57,7 +58,6 @@ namespace Genode {
GENODE_RPC(Rpc_assign_parent, int, assign_parent, Parent_capability); GENODE_RPC(Rpc_assign_parent, int, assign_parent, Parent_capability);
GENODE_RPC_INTERFACE(Rpc_bind_thread, Rpc_assign_parent); GENODE_RPC_INTERFACE(Rpc_bind_thread, Rpc_assign_parent);
}; };
}
#endif /* _INCLUDE__PD_SESSION__PD_SESSION_H_ */ #endif /* _INCLUDE__PD_SESSION__PD_SESSION_H_ */

View File

@ -17,13 +17,14 @@
/* Genode includes */ /* Genode includes */
#include <platform_exynos5/board_base.h> #include <platform_exynos5/board_base.h>
namespace Genode namespace Genode { struct Board_base; }
{
/**
/**
* Board driver base * Board driver base
*/ */
struct Board_base : Exynos5 struct Genode::Board_base : Exynos5
{ {
enum enum
{ {
/* clock management unit */ /* clock management unit */
@ -44,7 +45,6 @@ namespace Genode
/* wether board provides security extension */ /* wether board provides security extension */
SECURITY_EXTENSION = 1, SECURITY_EXTENSION = 1,
}; };
}; };
}
#endif /* _INCLUDE__DRIVERS__BOARD_BASE_H_ */ #endif /* _INCLUDE__DRIVERS__BOARD_BASE_H_ */

View File

@ -14,13 +14,14 @@
#ifndef _INCLUDE__PLATFORM__IMX53__DRIVERS__BOARD_BASE_SUPPORT_H_ #ifndef _INCLUDE__PLATFORM__IMX53__DRIVERS__BOARD_BASE_SUPPORT_H_
#define _INCLUDE__PLATFORM__IMX53__DRIVERS__BOARD_BASE_SUPPORT_H_ #define _INCLUDE__PLATFORM__IMX53__DRIVERS__BOARD_BASE_SUPPORT_H_
namespace Imx53 namespace Imx53 { struct Board_base; }
{
/**
/**
* i.MX53 motherboard * i.MX53 motherboard
*/ */
struct Board_base struct Imx53::Board_base
{ {
enum { enum {
MMIO_BASE = 0x0, MMIO_BASE = 0x0,
MMIO_SIZE = 0x70000000, MMIO_SIZE = 0x70000000,
@ -110,8 +111,7 @@ namespace Imx53
/* CPU cache */ /* CPU cache */
CACHE_LINE_SIZE_LOG2 = 6, CACHE_LINE_SIZE_LOG2 = 6,
}; };
}; };
}
#endif /* _INCLUDE__PLATFORM__IMX53__DRIVERS__BOARD_BASE_SUPPORT_H_ */ #endif /* _INCLUDE__PLATFORM__IMX53__DRIVERS__BOARD_BASE_SUPPORT_H_ */

View File

@ -17,21 +17,21 @@
/* Genode includes */ /* Genode includes */
#include <platform/imx53/drivers/board_base_support.h> #include <platform/imx53/drivers/board_base_support.h>
namespace Genode namespace Genode { struct Board_base; }
{
/**
/**
* i.MX53 starter board * i.MX53 starter board
*/ */
struct Board_base : Imx53::Board_base struct Genode::Board_base : Imx53::Board_base
{ {
enum { enum {
RAM0_BASE = 0x70000000, RAM0_BASE = 0x70000000,
RAM0_SIZE = 0x20000000, RAM0_SIZE = 0x20000000,
RAM1_BASE = 0xb0000000, RAM1_BASE = 0xb0000000,
RAM1_SIZE = 0x20000000, RAM1_SIZE = 0x20000000,
}; };
}; };
}
#endif /* _INCLUDE__PLATFORM__IMX53_QSB__DRIVERS__BOARD_BASE_H_ */ #endif /* _INCLUDE__PLATFORM__IMX53_QSB__DRIVERS__BOARD_BASE_H_ */

View File

@ -17,13 +17,14 @@
/* Genode includes */ /* Genode includes */
#include <platform_exynos5/board_base.h> #include <platform_exynos5/board_base.h>
namespace Genode namespace Genode { struct Board_base; }
{
/**
/**
* Board driver base * Board driver base
*/ */
struct Board_base : Exynos5 struct Genode::Board_base : Exynos5
{ {
enum enum
{ {
/* UART */ /* UART */
@ -32,7 +33,6 @@ namespace Genode
/* wether board provides security extension */ /* wether board provides security extension */
SECURITY_EXTENSION = 0, SECURITY_EXTENSION = 0,
}; };
}; };
}
#endif /* _INCLUDE__DRIVERS__BOARD_BASE_H_ */ #endif /* _INCLUDE__DRIVERS__BOARD_BASE_H_ */

View File

@ -14,15 +14,16 @@
#ifndef _INCLUDE__DRIVERS__BOARD_BASE_H_ #ifndef _INCLUDE__DRIVERS__BOARD_BASE_H_
#define _INCLUDE__DRIVERS__BOARD_BASE_H_ #define _INCLUDE__DRIVERS__BOARD_BASE_H_
namespace Genode namespace Genode { struct Board_base; }
{
/**
/**
* Driver for the OMAP4 PandaBoard revision A2 * Driver for the OMAP4 PandaBoard revision A2
*/ */
struct Board_base struct Genode::Board_base
{ {
enum enum {
{
/* device IO memory */ /* device IO memory */
MMIO_0_BASE = 0x48000000, MMIO_0_BASE = 0x48000000,
MMIO_0_SIZE = 0x01000000, MMIO_0_SIZE = 0x01000000,
@ -99,10 +100,8 @@ namespace Genode
/* wether board provides security extension */ /* wether board provides security extension */
SECURITY_EXTENSION = 0, SECURITY_EXTENSION = 0,
}; };
}; };
}
#endif /* _INCLUDE__DRIVERS__BOARD_BASE_H_ */ #endif /* _INCLUDE__DRIVERS__BOARD_BASE_H_ */

View File

@ -14,15 +14,16 @@
#ifndef _INCLUDE__DRIVERS__BOARD_BASE_H_ #ifndef _INCLUDE__DRIVERS__BOARD_BASE_H_
#define _INCLUDE__DRIVERS__BOARD_BASE_H_ #define _INCLUDE__DRIVERS__BOARD_BASE_H_
namespace Genode namespace Genode { struct Board_base; }
{
/**
/**
* Driver for the Realview PBXA9 board * Driver for the Realview PBXA9 board
*/ */
struct Board_base struct Genode::Board_base
{ {
enum enum {
{
/* normal RAM */ /* normal RAM */
RAM_0_BASE = 0x70000000, RAM_0_BASE = 0x70000000,
RAM_0_SIZE = 0x20000000, RAM_0_SIZE = 0x20000000,
@ -82,8 +83,7 @@ namespace Genode
/* wether board provides security extension */ /* wether board provides security extension */
SECURITY_EXTENSION = 0, SECURITY_EXTENSION = 0,
}; };
}; };
}
#endif /* _INCLUDE__DRIVERS__BOARD_BASE_H_ */ #endif /* _INCLUDE__DRIVERS__BOARD_BASE_H_ */

View File

@ -17,10 +17,11 @@
/* Genode includes */ /* Genode includes */
#include <util/mmio.h> #include <util/mmio.h>
namespace Genode namespace Genode { struct Board_base; }
struct Genode::Board_base
{ {
struct Board_base
{
enum { enum {
RAM_0_BASE = 0x00000000, RAM_0_BASE = 0x00000000,
RAM_0_SIZE = 0x10000000, /* XXX ? */ RAM_0_SIZE = 0x10000000, /* XXX ? */
@ -67,8 +68,7 @@ namespace Genode
COHERENT = 1, COHERENT = 1,
L2_ONLY = 2, L2_ONLY = 2,
UNCACHED = 3 }; UNCACHED = 3 };
}; };
}
#endif /* _INCLUDE__PLATFORM__BOARD_BASE_H_ */ #endif /* _INCLUDE__PLATFORM__BOARD_BASE_H_ */

View File

@ -17,13 +17,14 @@
/* Genode includes */ /* Genode includes */
#include <platform/imx53/drivers/board_base_support.h> #include <platform/imx53/drivers/board_base_support.h>
namespace Genode namespace Genode { struct Board_base; }
{
/**
/**
* i.MX53 starter board * i.MX53 starter board
*/ */
struct Board_base : Imx53::Board_base struct Genode::Board_base : Imx53::Board_base
{ {
enum { enum {
/* /*
* These two regions are physically one RAM region but we split it * These two regions are physically one RAM region but we split it
@ -35,8 +36,7 @@ namespace Genode
RAM1_BASE = 0x80000000, RAM1_BASE = 0x80000000,
RAM1_SIZE = 0x10000000, RAM1_SIZE = 0x10000000,
}; };
}; };
}
#endif /* _INCLUDE__PLATFORM__IMX53_QSB__DRIVERS__BOARD_BASE_H_ */ #endif /* _INCLUDE__PLATFORM__IMX53_QSB__DRIVERS__BOARD_BASE_H_ */

View File

@ -14,15 +14,16 @@
#ifndef _INCLUDE__PLATFORM__VEA9X4__DRIVERS__BOARD_BASE_H_ #ifndef _INCLUDE__PLATFORM__VEA9X4__DRIVERS__BOARD_BASE_H_
#define _INCLUDE__PLATFORM__VEA9X4__DRIVERS__BOARD_BASE_H_ #define _INCLUDE__PLATFORM__VEA9X4__DRIVERS__BOARD_BASE_H_
namespace Genode namespace Genode { struct Board_base; }
{
/**
/**
* Driver for the Versatile Express A9X4 board * Driver for the Versatile Express A9X4 board
* *
* Implies the uATX motherboard and the CoreTile Express A9X4 daughterboard * Implies the uATX motherboard and the CoreTile Express A9X4 daughterboard
*/ */
struct Board_base struct Genode::Board_base
{ {
enum enum
{ {
/* MMIO */ /* MMIO */
@ -76,8 +77,7 @@ namespace Genode
/* CPU cache */ /* CPU cache */
CACHE_LINE_SIZE_LOG2 = 2, /* FIXME get correct value from board spec */ CACHE_LINE_SIZE_LOG2 = 2, /* FIXME get correct value from board spec */
}; };
}; };
}
#endif /* _INCLUDE__PLATFORM__VEA9X4__DRIVERS__BOARD_BASE_H_ */ #endif /* _INCLUDE__PLATFORM__VEA9X4__DRIVERS__BOARD_BASE_H_ */

View File

@ -14,18 +14,14 @@
#ifndef _EXYNOS5__BOARD_BASE_H_ #ifndef _EXYNOS5__BOARD_BASE_H_
#define _EXYNOS5__BOARD_BASE_H_ #define _EXYNOS5__BOARD_BASE_H_
namespace Genode namespace Genode { struct Exynos5; }
{
/**
/**
* Board-driver base * Board-driver base
*/ */
class Exynos5; struct Genode::Exynos5
}
class Genode::Exynos5
{ {
public:
enum { enum {
/* normal RAM */ /* normal RAM */
RAM_0_BASE = 0x40000000, RAM_0_BASE = 0x40000000,

View File

@ -18,29 +18,29 @@
#include <ram_session/ram_session.h> #include <ram_session/ram_session.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
namespace Genode { namespace Genode { struct Ram_session_client; }
struct Ram_session_client : Rpc_client<Ram_session>
{ struct Genode::Ram_session_client : Rpc_client<Ram_session>
{
explicit Ram_session_client(Ram_session_capability session) explicit Ram_session_client(Ram_session_capability session)
: Rpc_client<Ram_session>(session) { } : Rpc_client<Ram_session>(session) { }
Ram_dataspace_capability alloc(size_t size, Ram_dataspace_capability alloc(size_t size,
Cache_attribute cached = CACHED) { Cache_attribute cached = CACHED) override {
return call<Rpc_alloc>(size, cached); } return call<Rpc_alloc>(size, cached); }
void free(Ram_dataspace_capability ds) { call<Rpc_free>(ds); } void free(Ram_dataspace_capability ds) override { call<Rpc_free>(ds); }
int ref_account(Ram_session_capability ram_session) { int ref_account(Ram_session_capability ram_session) override {
return call<Rpc_ref_account>(ram_session); } return call<Rpc_ref_account>(ram_session); }
int transfer_quota(Ram_session_capability ram_session, size_t amount) { int transfer_quota(Ram_session_capability ram_session, size_t amount) override {
return call<Rpc_transfer_quota>(ram_session, amount); } return call<Rpc_transfer_quota>(ram_session, amount); }
size_t quota() { return call<Rpc_quota>(); } size_t quota() override { return call<Rpc_quota>(); }
size_t used() { return call<Rpc_used>(); } size_t used() override { return call<Rpc_used>(); }
}; };
}
#endif /* _INCLUDE__RAM_SESSION__CLIENT_H_ */ #endif /* _INCLUDE__RAM_SESSION__CLIENT_H_ */

View File

@ -17,9 +17,8 @@
#include <ram_session/client.h> #include <ram_session/client.h>
#include <base/connection.h> #include <base/connection.h>
namespace Genode { namespace Genode { struct Ram_connection; }
struct Ram_connection;
}
struct Genode::Ram_connection : Connection<Ram_session>, Ram_session_client struct Genode::Ram_connection : Connection<Ram_session>, Ram_session_client
{ {

View File

@ -24,12 +24,18 @@
namespace Genode { namespace Genode {
struct Ram_dataspace : Dataspace { }; struct Ram_dataspace;
typedef Capability<Ram_dataspace> Ram_dataspace_capability; typedef Capability<Ram_dataspace> Ram_dataspace_capability;
struct Ram_session : Session struct Ram_session;
{ }
struct Genode::Ram_dataspace : Dataspace { };
struct Genode::Ram_session : Session
{
static const char *service_name() { return "RAM"; } static const char *service_name() { return "RAM"; }
@ -111,6 +117,7 @@ namespace Genode {
return q > u ? q - u : 0; return q > u ? q - u : 0;
} }
/********************* /*********************
** RPC declaration ** ** RPC declaration **
*********************/ *********************/
@ -126,7 +133,6 @@ namespace Genode {
GENODE_RPC_INTERFACE(Rpc_alloc, Rpc_free, Rpc_ref_account, GENODE_RPC_INTERFACE(Rpc_alloc, Rpc_free, Rpc_ref_account,
Rpc_transfer_quota, Rpc_quota, Rpc_used); Rpc_transfer_quota, Rpc_quota, Rpc_used);
}; };
}
#endif /* _INCLUDE__RAM_SESSION__RAM_SESSION_H_ */ #endif /* _INCLUDE__RAM_SESSION__RAM_SESSION_H_ */

View File

@ -17,41 +17,41 @@
#include <rm_session/capability.h> #include <rm_session/capability.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
namespace Genode { namespace Genode { struct Rm_session_client; }
struct Rm_session_client : Rpc_client<Rm_session>
{ struct Genode::Rm_session_client : Rpc_client<Rm_session>
{
explicit Rm_session_client(Rm_session_capability session) explicit Rm_session_client(Rm_session_capability session)
: Rpc_client<Rm_session>(session) { } : Rpc_client<Rm_session>(session) { }
Local_addr attach(Dataspace_capability ds, size_t size = 0, Local_addr attach(Dataspace_capability ds, size_t size = 0,
off_t offset = 0, bool use_local_addr = false, off_t offset = 0, bool use_local_addr = false,
Local_addr local_addr = (void *)0, Local_addr local_addr = (void *)0,
bool executable = false) bool executable = false) override
{ {
return call<Rpc_attach>(ds, size, offset, return call<Rpc_attach>(ds, size, offset,
use_local_addr, local_addr, use_local_addr, local_addr,
executable); executable);
} }
void detach(Local_addr local_addr) { void detach(Local_addr local_addr) override {
call<Rpc_detach>(local_addr); } call<Rpc_detach>(local_addr); }
Pager_capability add_client(Thread_capability thread) { Pager_capability add_client(Thread_capability thread) override {
return call<Rpc_add_client>(thread); } return call<Rpc_add_client>(thread); }
void remove_client(Pager_capability pager) { void remove_client(Pager_capability pager) override {
call<Rpc_remove_client>(pager); } call<Rpc_remove_client>(pager); }
void fault_handler(Signal_context_capability handler) { void fault_handler(Signal_context_capability handler) override {
call<Rpc_fault_handler>(handler); } call<Rpc_fault_handler>(handler); }
State state() { State state() override {
return call<Rpc_state>(); } return call<Rpc_state>(); }
Dataspace_capability dataspace() { Dataspace_capability dataspace() override {
return call<Rpc_dataspace>(); } return call<Rpc_dataspace>(); }
}; };
}
#endif /* _INCLUDE__RM_SESSION__CLIENT_H_ */ #endif /* _INCLUDE__RM_SESSION__CLIENT_H_ */

View File

@ -17,10 +17,11 @@
#include <rm_session/client.h> #include <rm_session/client.h>
#include <base/connection.h> #include <base/connection.h>
namespace Genode { namespace Genode { struct Rm_connection; }
struct Rm_connection : Connection<Rm_session>, Rm_session_client
{ struct Genode::Rm_connection : Connection<Rm_session>, Rm_session_client
{
enum { RAM_QUOTA = 64*1024 }; enum { RAM_QUOTA = 64*1024 };
/** /**
@ -34,7 +35,6 @@ namespace Genode {
session("ram_quota=64K, start=0x%p, size=0x%zx", session("ram_quota=64K, start=0x%p, size=0x%zx",
start, size)), start, size)),
Rm_session_client(cap()) { } Rm_session_client(cap()) { }
}; };
}
#endif /* _INCLUDE__RM_SESSION__CONNECTION_H_ */ #endif /* _INCLUDE__RM_SESSION__CONNECTION_H_ */

View File

@ -22,10 +22,11 @@
#include <pager/capability.h> #include <pager/capability.h>
#include <session/session.h> #include <session/session.h>
namespace Genode { namespace Genode { struct Rm_session; }
struct Rm_session : Session
{ struct Genode::Rm_session : Session
{
enum Fault_type { enum Fault_type {
READY = 0, READ_FAULT = 1, WRITE_FAULT = 2, EXEC_FAULT = 3 }; READY = 0, READ_FAULT = 1, WRITE_FAULT = 2, EXEC_FAULT = 3 };
@ -214,7 +215,6 @@ namespace Genode {
GENODE_RPC_INTERFACE(Rpc_attach, Rpc_detach, Rpc_add_client, GENODE_RPC_INTERFACE(Rpc_attach, Rpc_detach, Rpc_add_client,
Rpc_remove_client, Rpc_fault_handler, Rpc_state, Rpc_remove_client, Rpc_fault_handler, Rpc_state,
Rpc_dataspace); Rpc_dataspace);
}; };
}
#endif /* _INCLUDE__RM_SESSION__RM_SESSION_H_ */ #endif /* _INCLUDE__RM_SESSION__RM_SESSION_H_ */

View File

@ -19,6 +19,7 @@
namespace Genode { struct Rom_session_client; } namespace Genode { struct Rom_session_client; }
struct Genode::Rom_session_client : Rpc_client<Rom_session> struct Genode::Rom_session_client : Rpc_client<Rom_session>
{ {
explicit Rom_session_client(Rom_session_capability session) explicit Rom_session_client(Rom_session_capability session)

View File

@ -18,11 +18,12 @@
#include <base/connection.h> #include <base/connection.h>
#include <base/printf.h> #include <base/printf.h>
namespace Genode { namespace Genode { class Rom_connection; }
class Rom_connection : public Connection<Rom_session>,
class Genode::Rom_connection : public Connection<Rom_session>,
public Rom_session_client public Rom_session_client
{ {
public: public:
class Rom_connection_failed : public Parent::Exception { }; class Rom_connection_failed : public Parent::Exception { };
@ -45,16 +46,16 @@ namespace Genode {
/** /**
* Constructor * Constructor
* *
* \param filename name of ROM file * \param module_name name of ROM module
* \param label initial session label * \param label initial session label
* *
* \throw Rom_connection_failed * \throw Rom_connection_failed
*/ */
Rom_connection(const char *filename, const char *label = 0) : Rom_connection(const char *module_name, const char *label = 0)
Connection<Rom_session>(_create_session(filename, label)), :
Connection<Rom_session>(_create_session(module_name, label)),
Rom_session_client(cap()) Rom_session_client(cap())
{ } { }
}; };
}
#endif /* _INCLUDE__ROM_SESSION__CONNECTION_H_ */ #endif /* _INCLUDE__ROM_SESSION__CONNECTION_H_ */

View File

@ -23,14 +23,16 @@
namespace Genode { namespace Genode {
struct Rom_dataspace : Dataspace { }; struct Rom_dataspace;
struct Rom_session; struct Rom_session;
typedef Capability<Rom_dataspace> Rom_dataspace_capability; typedef Capability<Rom_dataspace> Rom_dataspace_capability;
} }
struct Genode::Rom_dataspace : Dataspace { };
struct Genode::Rom_session : Session struct Genode::Rom_session : Session
{ {
static const char *service_name() { return "ROM"; } static const char *service_name() { return "ROM"; }

View File

@ -17,22 +17,22 @@
#include <root/capability.h> #include <root/capability.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
namespace Genode { namespace Genode { struct Root_client; }
struct Root_client : Rpc_client<Root>
{ struct Genode::Root_client : Rpc_client<Root>
{
explicit Root_client(Root_capability root) explicit Root_client(Root_capability root)
: Rpc_client<Root>(root) { } : Rpc_client<Root>(root) { }
Session_capability session(Session_args const &args, Affinity const &affinity) { Session_capability session(Session_args const &args, Affinity const &affinity) override {
return call<Rpc_session>(args, affinity); } return call<Rpc_session>(args, affinity); }
void upgrade(Session_capability session, Upgrade_args const &args) { void upgrade(Session_capability session, Upgrade_args const &args) override {
call<Rpc_upgrade>(session, args); } call<Rpc_upgrade>(session, args); }
void close(Session_capability session) { void close(Session_capability session) override {
call<Rpc_close>(session); } call<Rpc_close>(session); }
}; };
}
#endif /* _INCLUDE__ROOT__CLIENT_H_ */ #endif /* _INCLUDE__ROOT__CLIENT_H_ */

View File

@ -26,11 +26,17 @@
namespace Genode { namespace Genode {
/** class Single_client;
class Multiple_clients;
template <typename, typename POLICY = Multiple_clients> class Root_component;
}
/**
* Session creation policy for a single-client service * Session creation policy for a single-client service
*/ */
class Single_client class Genode::Single_client
{ {
private: private:
bool _used; bool _used;
@ -48,20 +54,20 @@ namespace Genode {
} }
void release() { _used = false; } void release() { _used = false; }
}; };
/** /**
* Session-creation policy for a multi-client service * Session-creation policy for a multi-client service
*/ */
struct Multiple_clients struct Genode::Multiple_clients
{ {
void aquire(const char *) { } void aquire(const char *) { }
void release() { } void release() { }
}; };
/** /**
* Template for implementing the root interface * Template for implementing the root interface
* *
* \param SESSION_TYPE session-component type to manage, * \param SESSION_TYPE session-component type to manage,
@ -87,9 +93,10 @@ namespace Genode {
* The default policy 'Multiple_clients' imposes no restrictions on the * The default policy 'Multiple_clients' imposes no restrictions on the
* creation of new sessions. * creation of new sessions.
*/ */
template <typename SESSION_TYPE, typename POLICY = Multiple_clients> template <typename SESSION_TYPE, typename POLICY>
class Root_component : public Rpc_object<Typed_root<SESSION_TYPE> >, private POLICY class Genode::Root_component : public Rpc_object<Typed_root<SESSION_TYPE> >,
{ private POLICY
{
private: private:
/* /*
@ -189,7 +196,7 @@ namespace Genode {
********************/ ********************/
Session_capability session(Root::Session_args const &args, Session_capability session(Root::Session_args const &args,
Affinity const &affinity) Affinity const &affinity) override
{ {
if (!args.is_valid_string()) throw Root::Invalid_args(); if (!args.is_valid_string()) throw Root::Invalid_args();
@ -233,7 +240,7 @@ namespace Genode {
return _ep->manage(s); return _ep->manage(s);
} }
void upgrade(Session_capability session, Root::Upgrade_args const &args) void upgrade(Session_capability session, Root::Upgrade_args const &args) override
{ {
if (!args.is_valid_string()) throw Root::Invalid_args(); if (!args.is_valid_string()) throw Root::Invalid_args();
@ -244,7 +251,7 @@ namespace Genode {
_upgrade_session(s, args.string()); _upgrade_session(s, args.string());
} }
void close(Session_capability session) void close(Session_capability session) override
{ {
SESSION_TYPE * s = SESSION_TYPE * s =
dynamic_cast<SESSION_TYPE *>(_ep->lookup_and_lock(session)); dynamic_cast<SESSION_TYPE *>(_ep->lookup_and_lock(session));
@ -258,7 +265,6 @@ namespace Genode {
POLICY::release(); POLICY::release();
return; return;
} }
}; };
}
#endif /* _INCLUDE__ROOT__COMPONENT_H_ */ #endif /* _INCLUDE__ROOT__COMPONENT_H_ */

View File

@ -22,8 +22,13 @@
namespace Genode { namespace Genode {
struct Root struct Root;
{ template <typename> struct Typed_root;
}
struct Genode::Root
{
/********************* /*********************
** Exception types ** ** Exception types **
*********************/ *********************/
@ -74,10 +79,10 @@ namespace Genode {
GENODE_RPC(Rpc_close, void, close, Session_capability); GENODE_RPC(Rpc_close, void, close, Session_capability);
GENODE_RPC_INTERFACE(Rpc_session, Rpc_upgrade, Rpc_close); GENODE_RPC_INTERFACE(Rpc_session, Rpc_upgrade, Rpc_close);
}; };
/** /**
* Root interface supplemented with information about the managed * Root interface supplemented with information about the managed
* session type * session type
* *
@ -85,11 +90,10 @@ namespace Genode {
* correct session type to 'Parent::announce()' when announcing * correct session type to 'Parent::announce()' when announcing
* a service. * a service.
*/ */
template <typename SESSION_TYPE> template <typename SESSION_TYPE>
struct Typed_root : Root struct Genode::Typed_root : Root
{ {
typedef SESSION_TYPE Session_type; typedef SESSION_TYPE Session_type;
}; };
}
#endif /* _INCLUDE__ROOT__ROOT_H_ */ #endif /* _INCLUDE__ROOT__ROOT_H_ */

View File

@ -21,9 +21,10 @@
*/ */
#include <base/rpc.h> #include <base/rpc.h>
namespace Genode { namespace Genode { class Session; }
/**
/**
* Base class of session interfaces * Base class of session interfaces
* *
* Each session interface must implement the function 'service_name' * Each session interface must implement the function 'service_name'
@ -31,8 +32,6 @@ namespace Genode {
* This function returns the name of the service provided via the session * This function returns the name of the service provided via the session
* interface. * interface.
*/ */
class Session { }; class Genode::Session { };
}
#endif /* _INCLUDE__SESSION_H_ */ #endif /* _INCLUDE__SESSION_H_ */

View File

@ -19,25 +19,25 @@
#include <base/rpc_client.h> #include <base/rpc_client.h>
#include <signal_session/source_client.h> #include <signal_session/source_client.h>
namespace Genode { namespace Genode { struct Signal_session_client; }
struct Signal_session_client : Rpc_client<Signal_session>
{ struct Genode::Signal_session_client : Rpc_client<Signal_session>
{
explicit Signal_session_client(Signal_session_capability session) explicit Signal_session_client(Signal_session_capability session)
: Rpc_client<Signal_session>(session) { } : Rpc_client<Signal_session>(session) { }
Signal_source_capability signal_source() { Signal_source_capability signal_source() override {
return call<Rpc_signal_source>(); } return call<Rpc_signal_source>(); }
Signal_context_capability alloc_context(long imprint) { Signal_context_capability alloc_context(long imprint) override {
return call<Rpc_alloc_context>(imprint); } return call<Rpc_alloc_context>(imprint); }
void free_context(Signal_context_capability cap) { void free_context(Signal_context_capability cap) override {
call<Rpc_free_context>(cap); } call<Rpc_free_context>(cap); }
void submit(Signal_context_capability receiver, unsigned cnt = 1) { void submit(Signal_context_capability receiver, unsigned cnt = 1) override {
call<Rpc_submit>(receiver, cnt); } call<Rpc_submit>(receiver, cnt); }
}; };
}
#endif /* _INCLUDE__CAP_SESSION__CLIENT_H_ */ #endif /* _INCLUDE__CAP_SESSION__CLIENT_H_ */

View File

@ -17,16 +17,16 @@
#include <signal_session/client.h> #include <signal_session/client.h>
#include <base/connection.h> #include <base/connection.h>
namespace Genode { namespace Genode { struct Signal_connection; }
struct Signal_connection : Connection<Signal_session>, Signal_session_client
{ struct Genode::Signal_connection : Connection<Signal_session>, Signal_session_client
{
Signal_connection() Signal_connection()
: :
Connection<Signal_session>(session("ram_quota=12K")), Connection<Signal_session>(session("ram_quota=12K")),
Signal_session_client(cap()) Signal_session_client(cap())
{ } { }
}; };
}
#endif /* _INCLUDE__CAP_SESSION__CONNECTION_H_ */ #endif /* _INCLUDE__CAP_SESSION__CONNECTION_H_ */

View File

@ -24,14 +24,16 @@ namespace Genode {
class Signal_context; class Signal_context;
class Signal_receiver; class Signal_receiver;
typedef Capability<Signal_receiver> Signal_receiver_capability; typedef Capability<Signal_receiver> Signal_receiver_capability;
typedef Capability<Signal_context> Signal_context_capability; typedef Capability<Signal_context> Signal_context_capability;
typedef Capability<Signal_source> Signal_source_capability; typedef Capability<Signal_source> Signal_source_capability;
struct Signal_session;
}
struct Signal_session : Session
{ struct Genode::Signal_session : Session
{
static const char *service_name() { return "SIGNAL"; } static const char *service_name() { return "SIGNAL"; }
virtual ~Signal_session() { } virtual ~Signal_session() { }
@ -92,7 +94,6 @@ namespace Genode {
GENODE_RPC_INTERFACE(Rpc_submit, Rpc_signal_source, Rpc_alloc_context, GENODE_RPC_INTERFACE(Rpc_submit, Rpc_signal_source, Rpc_alloc_context,
Rpc_free_context); Rpc_free_context);
}; };
}
#endif /* _INCLUDE__CAP_SESSION__CAP_SESSION_H_ */ #endif /* _INCLUDE__CAP_SESSION__CAP_SESSION_H_ */

View File

@ -21,9 +21,10 @@
#include <base/rpc.h> #include <base/rpc.h>
namespace Genode { namespace Genode { struct Signal_source; }
/**
/**
* Blocking part of the signal-session interface * Blocking part of the signal-session interface
* *
* The blocking 'wait_for_signal()' function cannot be part of the * The blocking 'wait_for_signal()' function cannot be part of the
@ -32,8 +33,8 @@ namespace Genode {
* Therefore, the blocking part is implemented a separate interface, * Therefore, the blocking part is implemented a separate interface,
* which can be used by an independent thread. * which can be used by an independent thread.
*/ */
struct Signal_source struct Genode::Signal_source
{ {
class Signal class Signal
{ {
private: private:
@ -69,7 +70,6 @@ namespace Genode {
GENODE_RPC(Rpc_wait_for_signal, Signal, wait_for_signal); GENODE_RPC(Rpc_wait_for_signal, Signal, wait_for_signal);
GENODE_RPC_INTERFACE(Rpc_wait_for_signal); GENODE_RPC_INTERFACE(Rpc_wait_for_signal);
}; };
}
#endif /* _INCLUDE__SIGNAL_SESSION__SOURCE_H_ */ #endif /* _INCLUDE__SIGNAL_SESSION__SOURCE_H_ */

View File

@ -19,15 +19,15 @@
#include <signal_session/source.h> #include <signal_session/source.h>
#include <base/rpc_client.h> #include <base/rpc_client.h>
namespace Genode { namespace Genode { struct Signal_source_client; }
struct Signal_source_client : Rpc_client<Signal_source>
{ struct Genode::Signal_source_client : Rpc_client<Signal_source>
{
Signal_source_client(Signal_source_capability signal_source) Signal_source_client(Signal_source_capability signal_source)
: Rpc_client<Signal_source>(signal_source) { } : Rpc_client<Signal_source>(signal_source) { }
Signal wait_for_signal() { return call<Rpc_wait_for_signal>(); } Signal wait_for_signal() override { return call<Rpc_wait_for_signal>(); }
}; };
}
#endif /* _INCLUDE__SIGNAL_SESSION__SOURCE_CLIENT_H_ */ #endif /* _INCLUDE__SIGNAL_SESSION__SOURCE_CLIENT_H_ */

View File

@ -21,8 +21,8 @@
#include <signal_session/source.h> #include <signal_session/source.h>
#include <base/rpc_server.h> #include <base/rpc_server.h>
namespace Genode { namespace Genode { struct Signal_source_rpc_object; }
struct Signal_source_rpc_object : Rpc_object<Signal_source> { };
} struct Genode::Signal_source_rpc_object : Rpc_object<Signal_source> { };
#endif /* _INCLUDE__SIGNAL_SESSION__SOURCE_RPC_OBJECT_H_ */ #endif /* _INCLUDE__SIGNAL_SESSION__SOURCE_RPC_OBJECT_H_ */

Some files were not shown because too many files have changed in this diff Show More