2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief Dummy definitions for native types used for compiling unit tests
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2009-10-02
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 21:44:47 +01:00
|
|
|
* Copyright (C) 2009-2013 Genode Labs GmbH
|
2011-12-22 16:19:25 +01:00
|
|
|
*
|
|
|
|
* 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_
|
|
|
|
|
2012-03-08 12:45:18 +01:00
|
|
|
#include <base/native_capability.h>
|
2012-08-29 14:42:56 +02:00
|
|
|
#include <base/stdint.h>
|
2012-03-07 11:58:40 +01:00
|
|
|
|
2011-12-22 16:19:25 +01:00
|
|
|
namespace Codezero {
|
|
|
|
|
|
|
|
struct l4_mutex;
|
|
|
|
|
|
|
|
enum { NILTHREAD = -1 };
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Genode {
|
|
|
|
|
|
|
|
class Platform_thread;
|
|
|
|
|
2012-03-09 11:39:46 +01:00
|
|
|
struct Cap_dst_policy
|
2011-12-22 16:19:25 +01:00
|
|
|
{
|
2012-03-08 19:28:32 +01:00
|
|
|
typedef int Dst;
|
|
|
|
|
2012-03-09 11:39:46 +01:00
|
|
|
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);
|
|
|
|
};
|
|
|
|
|
2013-02-25 21:18:26 +01:00
|
|
|
typedef Cap_dst_policy::Dst Native_thread_id;
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
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; }
|
|
|
|
};
|
|
|
|
|
2012-03-09 11:39:46 +01:00
|
|
|
typedef Native_capability_tpl<Cap_dst_policy> Native_capability;
|
2011-12-22 16:19:25 +01:00
|
|
|
typedef int Native_connection_state;
|
2012-08-29 14:42:56 +02:00
|
|
|
|
|
|
|
struct Native_config
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Thread-context area configuration.
|
|
|
|
*/
|
2014-01-24 12:06:21 +01:00
|
|
|
static constexpr addr_t context_area_virtual_base() {
|
|
|
|
return 0x40000000UL; }
|
|
|
|
static constexpr addr_t context_area_virtual_size() {
|
|
|
|
return 0x10000000UL; }
|
2012-08-29 14:42:56 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Size of virtual address region holding the context of one thread
|
|
|
|
*/
|
2014-01-24 12:06:21 +01:00
|
|
|
static constexpr addr_t context_virtual_size() { return 0x00100000UL; }
|
2012-08-29 14:42:56 +02:00
|
|
|
};
|
2012-11-21 15:20:21 +01:00
|
|
|
|
|
|
|
struct Native_pd_args { };
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* _INCLUDE__BASE__NATIVE_TYPES_H_ */
|