mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-20 16:10:29 +00:00
Move repositories to 'repos/' subdirectory
This patch changes the top-level directory layout as a preparatory step for improving the tools for managing 3rd-party source codes. The rationale is described in the issue referenced below. Issue #1082
This commit is contained in:
112
repos/base-linux/include/base/ipc_msgbuf.h
Normal file
112
repos/base-linux/include/base/ipc_msgbuf.h
Normal file
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* \brief Linux-specific layout of IPC message buffer
|
||||
* \author Norman Feske
|
||||
* \date 2006-06-14
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__BASE__IPC_MSGBUF_H_
|
||||
#define _INCLUDE__BASE__IPC_MSGBUF_H_
|
||||
|
||||
namespace Genode {
|
||||
|
||||
/**
|
||||
* IPC message buffer layout
|
||||
*/
|
||||
class Msgbuf_base
|
||||
{
|
||||
public:
|
||||
|
||||
enum { MAX_CAPS_PER_MSG = 8 };
|
||||
|
||||
protected:
|
||||
|
||||
/*
|
||||
* Capabilities (file descriptors) to be transferred
|
||||
*/
|
||||
int _caps[MAX_CAPS_PER_MSG];
|
||||
Genode::size_t _used_caps;
|
||||
Genode::size_t _read_cap_index;
|
||||
|
||||
/**
|
||||
* Maximum size of plain-data message payload
|
||||
*/
|
||||
Genode::size_t _size;
|
||||
|
||||
/**
|
||||
* Actual size of plain-data message payload
|
||||
*/
|
||||
Genode::size_t _used_size;
|
||||
|
||||
char _msg_start[]; /* symbol marks start of message buffer data */
|
||||
|
||||
/*
|
||||
* No member variables are allowed beyond this point!
|
||||
*/
|
||||
|
||||
public:
|
||||
|
||||
char buf[];
|
||||
|
||||
Msgbuf_base() { reset_caps(); }
|
||||
|
||||
/**
|
||||
* Return size of message buffer
|
||||
*/
|
||||
inline Genode::size_t size() const { return _size; };
|
||||
|
||||
/**
|
||||
* Return address of message buffer
|
||||
*/
|
||||
inline void *addr() { return &_msg_start[0]; };
|
||||
|
||||
void reset_caps() { _used_caps = 0; _read_cap_index = 0; }
|
||||
|
||||
bool append_cap(int cap)
|
||||
{
|
||||
if (_used_caps == MAX_CAPS_PER_MSG)
|
||||
return false;
|
||||
|
||||
_caps[_used_caps++] = cap;
|
||||
return true;
|
||||
}
|
||||
|
||||
int read_cap()
|
||||
{
|
||||
if (_read_cap_index == _used_caps)
|
||||
return -1;
|
||||
|
||||
return _caps[_read_cap_index++];
|
||||
}
|
||||
|
||||
size_t used_caps() const { return _used_caps; }
|
||||
|
||||
int cap(unsigned index) const
|
||||
{
|
||||
return index < _used_caps ? _caps[index] : -1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Pump up IPC message buffer to specified buffer size
|
||||
*/
|
||||
template <unsigned BUF_SIZE>
|
||||
class Msgbuf : public Msgbuf_base
|
||||
{
|
||||
public:
|
||||
|
||||
char buf[BUF_SIZE];
|
||||
|
||||
Msgbuf() { _size = BUF_SIZE; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif /* _INCLUDE__BASE__IPC_MSGBUF_H_ */
|
175
repos/base-linux/include/base/native_types.h
Normal file
175
repos/base-linux/include/base/native_types.h
Normal file
@ -0,0 +1,175 @@
|
||||
/*
|
||||
* \brief Native types
|
||||
* \author Norman Feske
|
||||
* \date 2007-10-15
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__BASE__NATIVE_TYPES_H_
|
||||
#define _INCLUDE__BASE__NATIVE_TYPES_H_
|
||||
|
||||
#include <util/string.h>
|
||||
#include <base/native_capability.h>
|
||||
#include <base/stdint.h>
|
||||
|
||||
/*
|
||||
* We cannot just include <semaphore.h> and <pthread.h> here
|
||||
* because this would impy the nested inclusion of a myriad
|
||||
* of Linux types and would pollute the namespace for everyone
|
||||
* who includes this header file. We want to cleanly separate
|
||||
* Genode from POSIX.
|
||||
*/
|
||||
|
||||
namespace Genode {
|
||||
|
||||
/**
|
||||
* Thread ID
|
||||
*
|
||||
* Unfortunately, both - PID and TID - are needed for lx_tgkill()
|
||||
*/
|
||||
struct Native_thread_id
|
||||
{
|
||||
unsigned int tid; /* Native thread ID type as returned by the
|
||||
'clone' system call */
|
||||
unsigned int pid; /* process ID (resp. thread-group ID) */
|
||||
|
||||
Native_thread_id() : tid(0), pid(0) { }
|
||||
Native_thread_id(unsigned int tid, unsigned int pid)
|
||||
: tid(tid), pid(pid) { }
|
||||
};
|
||||
|
||||
struct Thread_meta_data;
|
||||
|
||||
/**
|
||||
* Native thread contains more thread-local data than just the ID
|
||||
*
|
||||
* FIXME doc
|
||||
* A thread needs two sockets as it may be a server that depends on another
|
||||
* service during request processing. If the server socket would be used for
|
||||
* the client call, the server thread may be unblocked by further requests
|
||||
* from its clients. In other words, the additional client socket provides
|
||||
* closed-receive semantics in calls. An even better solution is to use
|
||||
* SCM_RIGHTS messages to send a client socket descriptor with the request.
|
||||
*/
|
||||
struct Native_thread : Native_thread_id
|
||||
{
|
||||
bool is_ipc_server;
|
||||
|
||||
/**
|
||||
* Natively aligned memory location used in the lock implementation
|
||||
*/
|
||||
int futex_counter __attribute__((aligned(sizeof(Genode::addr_t))));
|
||||
|
||||
/**
|
||||
* Opaque pointer to additional thread-specific meta data
|
||||
*
|
||||
* This pointer is used by hybrid Linux/Genode program to maintain
|
||||
* POSIX-thread-related meta data. For non-hybrid Genode programs, it
|
||||
* remains unused.
|
||||
*/
|
||||
Thread_meta_data *meta_data;
|
||||
|
||||
Native_thread() : is_ipc_server(false), futex_counter(0), meta_data(0) { }
|
||||
};
|
||||
|
||||
inline bool operator == (Native_thread_id t1, Native_thread_id t2) {
|
||||
return (t1.tid == t2.tid) && (t1.pid == t2.pid); }
|
||||
|
||||
inline bool operator != (Native_thread_id t1, Native_thread_id t2) {
|
||||
return (t1.tid != t2.tid) || (t1.pid != t2.pid); }
|
||||
|
||||
struct Cap_dst_policy
|
||||
{
|
||||
struct Dst
|
||||
{
|
||||
int socket;
|
||||
|
||||
/**
|
||||
* Default constructor creates invalid destination
|
||||
*/
|
||||
Dst() : socket(-1) { }
|
||||
|
||||
explicit Dst(int socket) : socket(socket) { }
|
||||
};
|
||||
|
||||
static bool valid(Dst id) { return id.socket != -1; }
|
||||
static Dst invalid() { return Dst(); }
|
||||
static void copy(void* dst, Native_capability_tpl<Cap_dst_policy>* src);
|
||||
};
|
||||
|
||||
/**
|
||||
* Empty UTCB type expected by the thread library, unused on Linux
|
||||
*/
|
||||
typedef struct { } Native_utcb;
|
||||
|
||||
typedef Native_capability_tpl<Cap_dst_policy> Native_capability;
|
||||
|
||||
/**
|
||||
* The connection state is the socket handle of the RPC entrypoint
|
||||
*/
|
||||
struct Native_connection_state
|
||||
{
|
||||
int server_sd;
|
||||
int client_sd;
|
||||
|
||||
Native_connection_state() : server_sd(-1), client_sd(-1) { }
|
||||
};
|
||||
|
||||
enum { PARENT_SOCKET_HANDLE = 100 };
|
||||
|
||||
struct Native_config
|
||||
{
|
||||
/**
|
||||
* Thread-context area configuration.
|
||||
*
|
||||
* Please update platform-specific files after changing these
|
||||
* values, e.g., 'base-linux/src/platform/context_area.*.ld'.
|
||||
*/
|
||||
static constexpr addr_t context_area_virtual_base() {
|
||||
return 0x40000000UL; }
|
||||
static constexpr addr_t context_area_virtual_size() {
|
||||
return 0x10000000UL; }
|
||||
|
||||
/**
|
||||
* Size of virtual address region holding the context of one thread
|
||||
*/
|
||||
static constexpr addr_t context_virtual_size() { return 0x00100000UL; }
|
||||
};
|
||||
|
||||
class Native_pd_args
|
||||
{
|
||||
public:
|
||||
|
||||
enum { ROOT_PATH_MAX_LEN = 256 };
|
||||
|
||||
private:
|
||||
|
||||
char _root[ROOT_PATH_MAX_LEN];
|
||||
|
||||
unsigned _uid;
|
||||
unsigned _gid;
|
||||
|
||||
public:
|
||||
|
||||
Native_pd_args() : _uid(0), _gid(0) { _root[0] = 0; }
|
||||
|
||||
Native_pd_args(char const *root, unsigned uid, unsigned gid)
|
||||
:
|
||||
_uid(uid), _gid(gid)
|
||||
{
|
||||
Genode::strncpy(_root, root, sizeof(_root));
|
||||
}
|
||||
|
||||
char const *root() const { return _root; }
|
||||
unsigned uid() const { return _uid; }
|
||||
unsigned gid() const { return _gid; }
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__BASE__NATIVE_TYPES_H_ */
|
58
repos/base-linux/include/base/pager.h
Normal file
58
repos/base-linux/include/base/pager.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* \brief Paging-server framework
|
||||
* \author Norman Feske
|
||||
* \author Christian Helmuth
|
||||
* \date 2006-04-28
|
||||
*
|
||||
* Linux dummies
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006-2013 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__BASE__PAGER_H_
|
||||
#define _INCLUDE__BASE__PAGER_H_
|
||||
|
||||
#include <base/signal.h>
|
||||
#include <pager/capability.h>
|
||||
#include <cap_session/cap_session.h>
|
||||
#include <thread/capability.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
struct Pager_object
|
||||
{
|
||||
Thread_capability _thread_cap;
|
||||
Signal_context_capability _sigh;
|
||||
|
||||
|
||||
virtual ~Pager_object() { }
|
||||
|
||||
void exception_handler(Signal_context_capability sigh) { _sigh = sigh; }
|
||||
|
||||
/**
|
||||
* Remember thread cap so that rm_session can tell thread that
|
||||
* rm_client is gone.
|
||||
*/
|
||||
Thread_capability thread_cap() { return _thread_cap; } const
|
||||
void thread_cap(Thread_capability cap) { _thread_cap = cap; }
|
||||
|
||||
/* required by lookup_and_lock, provided by Object_pool::Entry normally */
|
||||
void release() { }
|
||||
};
|
||||
|
||||
class Pager_activation_base { };
|
||||
struct Pager_entrypoint
|
||||
{
|
||||
Pager_entrypoint(Cap_session *, Pager_activation_base *) { }
|
||||
|
||||
Pager_object *lookup_and_lock(Pager_capability) { return 0; }
|
||||
};
|
||||
template <int FOO> class Pager_activation : public Pager_activation_base { };
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__BASE__PAGER_H_ */
|
Reference in New Issue
Block a user