mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 20:42:56 +01: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:
33
repos/base-codezero/include/arm/cpu/atomic.h
Normal file
33
repos/base-codezero/include/arm/cpu/atomic.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* \brief Atomic operations for ARM on codezero
|
||||
* \author Norman Feske
|
||||
* \date 2009-10-02
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009-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__ARM__CPU__ATOMIC_H_
|
||||
#define _INCLUDE__ARM__CPU__ATOMIC_H_
|
||||
|
||||
namespace Genode {
|
||||
|
||||
/**
|
||||
* Atomic compare and exchange
|
||||
*
|
||||
* This function compares the value at dest with cmp_val.
|
||||
* If both values are equal, dest is set to new_val. If
|
||||
* both values are different, the value at dest remains
|
||||
* unchanged.
|
||||
*
|
||||
* \return 1 if the value was successfully changed to new_val,
|
||||
* 0 if cmp_val and the value at dest differ.
|
||||
*/
|
||||
int cmpxchg(volatile int *dest, int cmp_val, int new_val);
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__ARM__CPU__ATOMIC_H_ */
|
||||
63
repos/base-codezero/include/base/ipc_msgbuf.h
Normal file
63
repos/base-codezero/include/base/ipc_msgbuf.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* \brief IPC message buffer
|
||||
* \author Norman Feske
|
||||
* \date 2009-10-02
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009-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
|
||||
{
|
||||
protected:
|
||||
|
||||
size_t _size;
|
||||
char _msg_start[]; /* symbol marks start of message */
|
||||
|
||||
public:
|
||||
|
||||
/*
|
||||
* Begin of actual message buffer
|
||||
*/
|
||||
char buf[];
|
||||
|
||||
/**
|
||||
* Return size of message buffer
|
||||
*/
|
||||
inline size_t size() const { return _size; };
|
||||
|
||||
/**
|
||||
* Return address of message buffer
|
||||
*/
|
||||
inline void *addr() { return &_msg_start[0]; };
|
||||
|
||||
} __attribute__((aligned(4)));
|
||||
|
||||
/**
|
||||
* Instance of IPC message buffer with specified buffer size
|
||||
*/
|
||||
template <unsigned BUF_SIZE>
|
||||
class Msgbuf : public Msgbuf_base
|
||||
{
|
||||
public:
|
||||
|
||||
char buf[BUF_SIZE];
|
||||
|
||||
Msgbuf() { _size = BUF_SIZE; }
|
||||
|
||||
} __attribute__((aligned(4)));
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__BASE__IPC_MSGBUF_H_ */
|
||||
170
repos/base-codezero/include/base/ipc_pager.h
Normal file
170
repos/base-codezero/include/base/ipc_pager.h
Normal file
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* \brief Dummy pager support for Genode
|
||||
* \author Norman Feske
|
||||
* \date 2009-10-02
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009-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_PAGER_H_
|
||||
#define _INCLUDE__BASE__IPC_PAGER_H_
|
||||
|
||||
#include <base/ipc.h>
|
||||
#include <base/stdint.h>
|
||||
#include <base/native_types.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
class Mapping
|
||||
{
|
||||
private:
|
||||
|
||||
addr_t _from_phys_addr;
|
||||
addr_t _to_virt_addr;
|
||||
size_t _num_pages;
|
||||
bool _writeable;
|
||||
|
||||
enum { PAGE_SIZE_LOG2 = 12 };
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Mapping(addr_t dst_addr, addr_t src_addr,
|
||||
bool write_combined, bool io_mem,
|
||||
unsigned l2size = PAGE_SIZE_LOG2,
|
||||
bool rw = true)
|
||||
:
|
||||
_from_phys_addr(src_addr),
|
||||
_to_virt_addr(dst_addr),
|
||||
_num_pages(1 << (l2size - PAGE_SIZE_LOG2)),
|
||||
_writeable(rw)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Construct invalid mapping
|
||||
*/
|
||||
Mapping() : _num_pages(0) { }
|
||||
|
||||
/**
|
||||
* Prepare map operation
|
||||
*
|
||||
* No preparations are needed on Codezero because all mapping
|
||||
* originate from the physical address space.
|
||||
*/
|
||||
void prepare_map_operation() { }
|
||||
|
||||
addr_t from_phys() const { return _from_phys_addr; }
|
||||
addr_t to_virt() const { return _to_virt_addr; }
|
||||
size_t num_pages() const { return _num_pages; }
|
||||
bool writeable() const { return _writeable; }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Special paging server class
|
||||
*/
|
||||
class Ipc_pager : public Native_capability
|
||||
{
|
||||
private:
|
||||
|
||||
Native_thread_id _last; /* faulted thread */
|
||||
addr_t _pf_addr; /* page-fault address */
|
||||
addr_t _pf_ip; /* instruction pointer of faulter */
|
||||
bool _pf_write; /* true on write fault */
|
||||
|
||||
Mapping _reply_mapping;
|
||||
|
||||
// protected:
|
||||
//
|
||||
// /**
|
||||
// * Wait for pagefault
|
||||
// */
|
||||
// void _wait();
|
||||
//
|
||||
// /**
|
||||
// * Send page-fault reply and wait for next page fault
|
||||
// */
|
||||
// void _reply_and_wait();
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Ipc_pager();
|
||||
|
||||
/**
|
||||
* Wait for a new page fault received as short message IPC
|
||||
*/
|
||||
void wait_for_fault();
|
||||
|
||||
/**
|
||||
* Reply current page-fault and wait for a new one
|
||||
*/
|
||||
void reply_and_wait_for_fault();
|
||||
|
||||
/**
|
||||
* Request instruction pointer of current page fault
|
||||
*/
|
||||
addr_t fault_ip() { return _pf_ip; }
|
||||
|
||||
/**
|
||||
* Request fault address of current page fault
|
||||
*/
|
||||
addr_t fault_addr() { return _pf_addr; }
|
||||
|
||||
/**
|
||||
* Set parameters for next reply
|
||||
*/
|
||||
void set_reply_mapping(Mapping m) { _reply_mapping = m; }
|
||||
|
||||
/**
|
||||
* Set destination for next reply
|
||||
*/
|
||||
void set_reply_dst(Native_capability pager_object) {
|
||||
_last = pager_object.local_name(); }
|
||||
|
||||
/**
|
||||
* Answer call without sending a mapping
|
||||
*
|
||||
* This function is used to acknowledge local calls from one of
|
||||
* core's region-manager sessions.
|
||||
*/
|
||||
void acknowledge_wakeup();
|
||||
|
||||
/**
|
||||
* Return thread ID of last faulter
|
||||
*/
|
||||
Native_thread_id last() const { return _last; }
|
||||
|
||||
/**
|
||||
* Return badge for faulting thread
|
||||
*/
|
||||
unsigned long badge() const { return _last; }
|
||||
|
||||
/**
|
||||
* Return true if page fault was a write fault
|
||||
*/
|
||||
bool is_write_fault() const { return _pf_write; }
|
||||
|
||||
/**
|
||||
* Return true if last fault was an exception
|
||||
*/
|
||||
bool is_exception() const
|
||||
{
|
||||
/*
|
||||
* Reflection of exceptions is not supported on this platform.
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__BASE__IPC_PAGER_H_ */
|
||||
113
repos/base-codezero/include/base/native_types.h
Normal file
113
repos/base-codezero/include/base/native_types.h
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* \brief Dummy definitions for native types used for compiling unit tests
|
||||
* \author Norman Feske
|
||||
* \date 2009-10-02
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009-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 <base/native_capability.h>
|
||||
#include <base/stdint.h>
|
||||
|
||||
namespace Codezero {
|
||||
|
||||
struct l4_mutex;
|
||||
|
||||
enum { NILTHREAD = -1 };
|
||||
}
|
||||
|
||||
namespace Genode {
|
||||
|
||||
class Platform_thread;
|
||||
|
||||
struct Cap_dst_policy
|
||||
{
|
||||
typedef int Dst;
|
||||
|
||||
static bool valid(Dst tid) { return tid != Codezero::NILTHREAD; }
|
||||
static Dst invalid() { return Codezero::NILTHREAD; }
|
||||
static void copy(void* dst, Native_capability_tpl<Cap_dst_policy>* src);
|
||||
};
|
||||
|
||||
typedef Cap_dst_policy::Dst Native_thread_id;
|
||||
|
||||
struct Native_thread
|
||||
{
|
||||
Native_thread_id l4id;
|
||||
|
||||
/**
|
||||
* Only used in core
|
||||
*
|
||||
* For 'Thread' objects created within core, 'pt' points to the
|
||||
* physical thread object, which is going to be destroyed on
|
||||
* destruction of the 'Thread'.
|
||||
*/
|
||||
Platform_thread *pt;
|
||||
};
|
||||
|
||||
/**
|
||||
* Empty UTCB type expected by the thread library
|
||||
*
|
||||
* On this kernel, UTCBs are not placed within the the context area. Each
|
||||
* thread can request its own UTCB pointer using the kernel interface.
|
||||
* However, we use the 'Native_utcb' member of the thread context to
|
||||
* hold thread-specific data, i.e. the running lock used by the lock
|
||||
* implementation.
|
||||
*/
|
||||
struct Native_utcb
|
||||
{
|
||||
private:
|
||||
|
||||
/**
|
||||
* Prevent construction
|
||||
*
|
||||
* A UTCB is never constructed, it is backed by zero-initialized memory.
|
||||
*/
|
||||
Native_utcb();
|
||||
|
||||
/**
|
||||
* Backing store for per-thread running lock
|
||||
*
|
||||
* The size of this member must equal 'sizeof(Codezero::l4_mutex)'.
|
||||
* Unfortunately, we cannot include the Codezero headers here.
|
||||
*/
|
||||
int _running_lock;
|
||||
|
||||
public:
|
||||
|
||||
Codezero::l4_mutex *running_lock() {
|
||||
return (Codezero::l4_mutex *)&_running_lock; }
|
||||
};
|
||||
|
||||
typedef Native_capability_tpl<Cap_dst_policy> Native_capability;
|
||||
typedef int Native_connection_state;
|
||||
|
||||
struct Native_config
|
||||
{
|
||||
/**
|
||||
* Thread-context area configuration.
|
||||
*/
|
||||
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; }
|
||||
};
|
||||
|
||||
struct Native_pd_args { };
|
||||
}
|
||||
|
||||
|
||||
#endif /* _INCLUDE__BASE__NATIVE_TYPES_H_ */
|
||||
76
repos/base-codezero/include/codezero/syscalls.h
Normal file
76
repos/base-codezero/include/codezero/syscalls.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* \brief Aggregate Codezero syscall bindings
|
||||
* \author Norman Feske
|
||||
* \date 2010-02-16
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-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__CODEZERO__SYSCALLS_H_
|
||||
#define _INCLUDE__CODEZERO__SYSCALLS_H_
|
||||
|
||||
/*
|
||||
* Codezero headers happen to include the compiler's 'stdarg.h'. If this
|
||||
* happened within the 'Codezero' namespace below, we would not be able to
|
||||
* include 'stdarg.h' later on into the root namespace (stdarg's include guards
|
||||
* would prevent this. Therefore, we make sure to include the file into the
|
||||
* root namespace prior processing any Codezero headers.
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
|
||||
namespace Codezero { extern "C" {
|
||||
|
||||
/* make Codezero includes happy */
|
||||
extern char *strncpy(char *dest, const char *src, __SIZE_TYPE__);
|
||||
extern void *memcpy(void *dest, const void *src, __SIZE_TYPE__);
|
||||
|
||||
/*
|
||||
* Work around the problem of C++ keywords being used as
|
||||
* argument names in the Codezero API headers.
|
||||
*/
|
||||
#define new _new_
|
||||
#define virtual _virtual_
|
||||
#define printf(A, ...)
|
||||
|
||||
#include <l4lib/macros.h>
|
||||
#include <l4lib/arch/arm/syscalls.h>
|
||||
#include <l4lib/arch/arm/syslib.h>
|
||||
#include <l4lib/ipcdefs.h>
|
||||
#include <l4lib/init.h>
|
||||
#include <l4lib/mutex.h>
|
||||
#include <l4/api/thread.h>
|
||||
#include <l4/api/irq.h>
|
||||
#include <l4lib/exregs.h>
|
||||
#include <l4/lib/list.h> /* needed for capability.h */
|
||||
#include <l4/generic/capability.h>
|
||||
#include <l4/generic/cap-types.h>
|
||||
#include <l4/arch/arm/exception.h>
|
||||
#include <l4/arch/arm/io.h>
|
||||
|
||||
#undef new
|
||||
#undef virtual
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
#undef printf
|
||||
} }
|
||||
|
||||
namespace Codezero {
|
||||
|
||||
/**
|
||||
* Return thread ID of the calling thread
|
||||
*/
|
||||
inline int thread_myself()
|
||||
{
|
||||
struct task_ids ids = { 0, 0, 0 };
|
||||
l4_getid(&ids);
|
||||
return ids.tid;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__CODEZERO__SYSCALLS_H_ */
|
||||
Reference in New Issue
Block a user