base-hw: don't use 'long' unnecessarily

Fix #581
This commit is contained in:
Martin Stein 2012-12-19 14:46:48 +01:00 committed by Norman Feske
parent 28f81c4a9c
commit 4fb5c23a3c
26 changed files with 150 additions and 157 deletions

View File

@ -151,7 +151,7 @@ namespace Genode
/**
* Return badge for faulting thread
*/
unsigned long badge() const { return _pagefault.thread_id; }
unsigned badge() const { return _pagefault.thread_id; }
/**
* Return true if last fault was a write fault

View File

@ -26,7 +26,7 @@ namespace Genode
typedef int volatile Native_lock;
typedef Platform_thread * Native_thread;
typedef unsigned long Native_thread_id;
typedef unsigned Native_thread_id;
typedef int Native_connection_state;
/* FIXME needs to be MMU dependent */
@ -48,11 +48,11 @@ namespace Genode
*/
struct Pagefault
{
unsigned long thread_id; /* thread ID of the faulter */
Tlb * tlb; /* TLB to wich the faulter is assigned */
addr_t virt_ip; /* the faulters virtual instruction pointer */
addr_t virt_address; /* virtual fault address */
bool write; /* write access attempted at fault? */
unsigned thread_id; /* thread ID of the faulter */
Tlb * tlb; /* TLB to wich the faulter is assigned */
addr_t virt_ip; /* the faulters virtual instruction pointer */
addr_t virt_address; /* virtual fault address */
bool write; /* write access attempted at fault? */
/**
* Placement new operator
@ -94,7 +94,7 @@ namespace Genode
/**
* Get pointer to a specific word within the UTCB
*/
umword_t * word(unsigned long const index) { return &words[index]; }
umword_t * word(unsigned const index) { return &words[index]; }
/**
* Get the base of the UTCB
@ -104,7 +104,7 @@ namespace Genode
/**
* Get the UTCB size
*/
unsigned long size() { return sizeof(bytes); }
size_t size() { return sizeof(bytes); }
};
struct Cap_dst_policy

View File

@ -30,16 +30,16 @@ namespace Genode
*/
class Signal
{
unsigned long _imprint; /* receiver-local signal-context pointer */
int _num; /* how often this signal has been triggered */
unsigned _imprint; /* receiver-local signal-context pointer */
int _num; /* how often this signal has been triggered */
public:
/**
* Construct valid signal
*/
Signal(unsigned long const imprint, int const num)
: _imprint(imprint), _num(num) { }
Signal(unsigned const imprint, int const num) :
_imprint(imprint), _num(num) { }
/***************
** Accessors **

View File

@ -25,6 +25,11 @@ namespace Genode
namespace Kernel
{
typedef Genode::Tlb Tlb;
typedef Genode::addr_t addr_t;
typedef Genode::size_t size_t;
typedef Genode::Platform_thread Platform_thread;
/**
* Unique opcodes of all syscalls supported by the kernel
*/
@ -113,17 +118,17 @@ namespace Kernel
/**
* Virtual range of the mode transition region in every PD
*/
Genode::addr_t mode_transition_virt_base();
Genode::size_t mode_transition_size();
addr_t mode_transition_virt_base();
size_t mode_transition_size();
/**
* Get sizes of the kernel objects
*/
Genode::size_t thread_size();
Genode::size_t pd_size();
Genode::size_t signal_context_size();
Genode::size_t signal_receiver_size();
Genode::size_t vm_size();
size_t thread_size();
size_t pd_size();
size_t signal_context_size();
size_t signal_receiver_size();
size_t vm_size();
/**
* Get alignment constraints of the kernel objects
@ -162,8 +167,8 @@ namespace Kernel
*
* Restricted to core threads.
*/
inline void update_pd(unsigned long const pd_id)
{ syscall(UPDATE_PD, (Syscall_arg)pd_id); }
inline void update_pd(unsigned const pd_id) {
syscall(UPDATE_PD, (Syscall_arg)pd_id); }
/**
@ -179,8 +184,9 @@ namespace Kernel
* Restricted to core threads. Regaining of the supplied memory can be done
* through 'delete_thread'.
*/
inline int new_thread(void * const dst, Genode::Platform_thread * const pt)
{ return syscall(NEW_THREAD, (Syscall_arg)dst, (Syscall_arg)pt); }
inline int
new_thread(void * const dst, Platform_thread * const pt) {
return syscall(NEW_THREAD, (Syscall_arg)dst, (Syscall_arg)pt); }
/**
* Delete an existing thread
@ -207,11 +213,10 @@ namespace Kernel
*
* Restricted to core threads.
*/
inline Genode::Tlb *
start_thread(Genode::Platform_thread * const phys_pt, void * ip, void * sp,
unsigned int cpu_no)
inline Tlb * start_thread(Platform_thread * const phys_pt, void * ip,
void * sp, unsigned cpu_no)
{
return (Genode::Tlb *)syscall(START_THREAD, (Syscall_arg)phys_pt,
return (Tlb *)syscall(START_THREAD, (Syscall_arg)phys_pt,
(Syscall_arg)ip, (Syscall_arg)sp,
(Syscall_arg)cpu_no);
}
@ -229,8 +234,8 @@ namespace Kernel
*
* If the caller doesn't target itself, this is restricted to core threads.
*/
inline int pause_thread(unsigned long const id = 0)
{ return syscall(PAUSE_THREAD, id); }
inline int pause_thread(unsigned const id = 0) {
return syscall(PAUSE_THREAD, id); }
/**
@ -243,8 +248,8 @@ namespace Kernel
* \retval <0 if targeted thread doesn't participate in CPU
* scheduling after
*/
inline int resume_thread(unsigned long const id = 0)
{ return syscall(RESUME_THREAD, id); }
inline int resume_thread(unsigned const id = 0) {
return syscall(RESUME_THREAD, id); }
/**
@ -252,7 +257,7 @@ namespace Kernel
*
* \param id ID of the targeted thread
*/
inline void resume_faulter(unsigned long const id = 0) {
inline void resume_faulter(unsigned const id = 0) {
syscall(RESUME_FAULTER, id); }
@ -262,8 +267,8 @@ namespace Kernel
* \param id if this thread ID is set and valid this will resume the
* targeted thread additionally
*/
inline void yield_thread(unsigned long const id = 0)
{ syscall(YIELD_THREAD, id); }
inline void yield_thread(unsigned const id = 0) {
syscall(YIELD_THREAD, id); }
/**
@ -279,8 +284,8 @@ namespace Kernel
*
* Restricted to core threads.
*/
inline Genode::Platform_thread * get_thread(unsigned long const id = 0)
{ return (Genode::Platform_thread *)syscall(GET_THREAD, id); }
inline Platform_thread * get_thread(unsigned const id = 0) {
return (Platform_thread *)syscall(GET_THREAD, id); }
/**
@ -294,9 +299,8 @@ namespace Kernel
* If the receiver exists, this blocks execution until a dedicated reply
* message has been send by the receiver. The receiver may never do so.
*/
inline unsigned long request_and_wait(unsigned long const id,
unsigned long const size)
{ return (unsigned long)syscall(REQUEST_AND_WAIT, id, size); }
inline size_t request_and_wait(unsigned const id, size_t const size) {
return (size_t)syscall(REQUEST_AND_WAIT, id, size); }
/**
@ -304,8 +308,8 @@ namespace Kernel
*
* \return size of received request (beginning with the callers UTCB base)
*/
inline unsigned long wait_for_request()
{ return (unsigned long)syscall(WAIT_FOR_REQUEST); }
inline size_t wait_for_request() {
return (size_t)syscall(WAIT_FOR_REQUEST); }
/**
@ -317,9 +321,8 @@ namespace Kernel
* \return request size (beginning with the callers UTCB base)
* if await_request was set
*/
inline unsigned long reply(unsigned long const size,
bool const await_request) {
return (unsigned long)syscall(REPLY, size, await_request); }
inline size_t reply(size_t const size, bool const await_request) {
return (size_t)syscall(REPLY, size, await_request); }
/**
@ -336,9 +339,8 @@ namespace Kernel
*
* Restricted to core threads.
*/
inline void set_pager(unsigned long const pager_id,
unsigned long const faulter_id)
{ syscall(SET_PAGER, pager_id, faulter_id); }
inline void set_pager(unsigned const pager_id, unsigned const faulter_id) {
syscall(SET_PAGER, pager_id, faulter_id); }
/**
* Print a char 'c' to the kernels serial ouput
@ -355,8 +357,8 @@ namespace Kernel
*
* Restricted to core threads.
*/
inline bool allocate_irq(unsigned long const id)
{ return syscall(ALLOCATE_IRQ, (Syscall_arg)id); }
inline bool allocate_irq(unsigned const id) {
return syscall(ALLOCATE_IRQ, (Syscall_arg)id); }
/**
@ -368,8 +370,8 @@ namespace Kernel
*
* Restricted to core threads.
*/
inline bool free_irq(unsigned long const id)
{ return syscall(FREE_IRQ, (Syscall_arg)id); }
inline bool free_irq(unsigned const id) {
return syscall(FREE_IRQ, (Syscall_arg)id); }
/**
@ -420,8 +422,8 @@ namespace Kernel
* Restricted to core threads. Regaining of the supplied memory is not
* supported by now.
*/
inline unsigned long new_signal_receiver(void * dst)
{ return syscall(NEW_SIGNAL_RECEIVER, (Syscall_arg)dst); }
inline unsigned new_signal_receiver(void * dst) {
return syscall(NEW_SIGNAL_RECEIVER, (Syscall_arg)dst); }
/**
@ -440,9 +442,8 @@ namespace Kernel
* Core-only syscall. Regaining of the supplied memory is not
* supported by now.
*/
inline unsigned long new_signal_context(void * dst,
unsigned long receiver_id,
unsigned long imprint)
inline unsigned new_signal_context(void * dst, unsigned receiver_id,
unsigned imprint)
{
return syscall(NEW_SIGNAL_CONTEXT, (Syscall_arg)dst,
(Syscall_arg)receiver_id, (Syscall_arg)imprint);
@ -462,8 +463,8 @@ namespace Kernel
* multiple contexts trigger simultanously there is no assertion about
* wich thread receives the 'Signal' instance of wich context.
*/
inline void await_signal(unsigned long receiver_id)
{ syscall(AWAIT_SIGNAL, (Syscall_arg)receiver_id); }
inline void await_signal(unsigned receiver_id) {
syscall(AWAIT_SIGNAL, (Syscall_arg)receiver_id); }
/**
@ -471,7 +472,7 @@ namespace Kernel
*
* \param receiver_id ID of the targeted receiver kernel-object
*/
inline bool signal_pending(unsigned long receiver_id) {
inline bool signal_pending(unsigned receiver_id) {
return syscall(SIGNAL_PENDING, (Syscall_arg)receiver_id); }
@ -481,26 +482,26 @@ namespace Kernel
* \param context_id ID of the targeted context kernel-object
* \param num how often the context shall be triggered by this call
*/
inline void submit_signal(unsigned long context_id, int num)
{ syscall(SUBMIT_SIGNAL, (Syscall_arg)context_id, (Syscall_arg)num); }
inline void submit_signal(unsigned context_id, int num) {
syscall(SUBMIT_SIGNAL, (Syscall_arg)context_id, (Syscall_arg)num); }
/**
* Create a new vm that is stopped initially
* Create a new virtual-machine that is stopped initially
*
* \param dst physical base of an appropriate portion of memory
* that is thereupon allocated to the kernel
* \param state location of the cpu state of the VM
* \param context_id ID of the targeted signal context
* \param dst physical base of an appropriate portion of memory
* that is thereupon allocated to the kernel
* \param state location of the CPU state of the VM
* \param context_id ID of the targeted signal context
*
* \retval >0 ID of the new vm
* \retval 0 if no new vm was created
* \retval >0 ID of the new VM
* \retval 0 if no new VM was created
*
* Restricted to core threads. Regaining of the supplied memory is not
* supported by now.
*/
inline int new_vm(void * const dst, void * const state,
unsigned long context_id)
unsigned context_id)
{
return syscall(NEW_VM, (Syscall_arg)dst, (Syscall_arg)state,
(Syscall_arg)context_id);
@ -510,9 +511,11 @@ namespace Kernel
/**
* Execute a virtual-machine (again)
*
* \param id ID of the targeted vm
* \param id ID of the targeted VM
*
* Restricted to core threads.
*/
inline void run_vm(unsigned long const id = 0) {
inline void run_vm(unsigned const id = 0) {
syscall(RUN_VM, (Syscall_arg)id); }
}

View File

@ -43,8 +43,8 @@ namespace Genode
Signal_context_capability
alloc_context(Signal_receiver_capability const r,
unsigned long const imprint)
{ return call<Rpc_alloc_context>(r, imprint); }
unsigned const imprint) {
return call<Rpc_alloc_context>(r, imprint); }
};
}

View File

@ -76,7 +76,7 @@ namespace Genode
*/
virtual Signal_context_capability
alloc_context(Signal_receiver_capability const r,
unsigned long const imprint) = 0;
unsigned const imprint) = 0;
/*********************
** RPC declaration **
@ -86,7 +86,7 @@ namespace Genode
alloc_receiver, GENODE_TYPE_LIST(Out_of_metadata));
GENODE_RPC_THROW(Rpc_alloc_context, Signal_context_capability,
alloc_context, GENODE_TYPE_LIST(Out_of_metadata),
Signal_receiver_capability, unsigned long);
Signal_receiver_capability, unsigned);
GENODE_RPC_INTERFACE(Rpc_alloc_receiver, Rpc_alloc_context);
};

View File

@ -40,23 +40,23 @@ enum
/**
* Translate byte size 's' to size in words
*/
static unsigned long size_in_words(unsigned long const s)
{ return (s + sizeof(unsigned long) - 1) / sizeof(unsigned long); }
static size_t size_in_words(size_t const s) {
return (s + sizeof(size_t) - 1) / sizeof(size_t); }
/**
* Copy message payload to message buffer
*/
static void copy_utcb_to_msgbuf(Msgbuf_base * const receive_buffer,
unsigned long const message_size)
size_t const message_size)
{
/* log data that is received via IPC */
enum { VERBOSE = 0 };
/* get pointers and message attributes */
Native_utcb * const utcb = Thread_base::myself()->utcb();
unsigned long * const msgbuf = (unsigned long *)receive_buffer->buf;
unsigned long const message_wsize = size_in_words(message_size);
Native_utcb * const utcb = Thread_base::myself()->utcb();
unsigned * const msgbuf = (unsigned *)receive_buffer->buf;
size_t const message_wsize = size_in_words(message_size);
/* assertions, avoid 'printf' in here, it may lead to infinite recursion */
if (message_wsize > size_in_words(utcb->size()))
@ -74,16 +74,16 @@ static void copy_utcb_to_msgbuf(Msgbuf_base * const receive_buffer,
* Copy message payload to the UTCB
*/
static void copy_msgbuf_to_utcb(Msgbuf_base * const send_buffer,
unsigned long const message_size,
unsigned long const local_name)
size_t const message_size,
unsigned const local_name)
{
/* log data that is send via IPC */
enum { VERBOSE = 0 };
/* get pointers and message attributes */
Native_utcb * const utcb = Thread_base::myself()->utcb();
unsigned long * const msgbuf = (unsigned long *)send_buffer->buf;
unsigned long const message_wsize = size_in_words(message_size);
Native_utcb * const utcb = Thread_base::myself()->utcb();
unsigned * const msgbuf = (unsigned *)send_buffer->buf;
size_t const message_wsize = size_in_words(message_size);
/* assertions, avoid 'printf' in here, it may lead to infinite recursion */
if (message_wsize > size_in_words(utcb->size()))
@ -95,7 +95,7 @@ static void copy_msgbuf_to_utcb(Msgbuf_base * const send_buffer,
*utcb->word(0) = local_name;
/* write message payload */
for (unsigned long i = 1; i < message_wsize; i++)
for (unsigned i = 1; i < message_wsize; i++)
*utcb->word(i) = msgbuf[i];
}

View File

@ -84,7 +84,7 @@ Signal_context_capability Signal_receiver::manage(Signal_context * const c)
Signal_connection * const s = signal_connection();
while (1) {
try {
c->_cap = s->alloc_context(_cap, (unsigned long)c);
c->_cap = s->alloc_context(_cap, (unsigned)c);
break;
} catch (Signal_session::Out_of_metadata)
{

View File

@ -161,7 +161,7 @@ namespace Arm_v6
* \param process_id process ID of the initial address space
*/
static void init_virt_kernel(addr_t const section_table,
unsigned long const process_id)
unsigned const process_id)
{
Cidr::write(process_id);
Dacr::write(Dacr::init_virt_kernel());

View File

@ -168,7 +168,7 @@ namespace Arm_v7
* \param process_id process ID of the initial address space
*/
static void init_virt_kernel(addr_t const section_table,
unsigned long const process_id)
unsigned const process_id)
{
Cidr::write(process_id);
Dacr::write(Dacr::init_virt_kernel());

View File

@ -36,8 +36,8 @@ namespace Genode
*/
class Platform_pd
{
unsigned long _id; /* ID of our kernel object */
Native_capability _parent; /* our parent interface */
unsigned _id; /* ID of our kernel object */
Native_capability _parent; /* our parent interface */
Native_thread_id _main_thread; /* the first thread that gets
* executed in this PD */

View File

@ -41,9 +41,9 @@ namespace Genode {
enum { NAME_MAX_LEN = 32 };
Thread_base * _thread_base;
unsigned long _stack_size;
unsigned long _pd_id;
unsigned long _id;
size_t _stack_size;
unsigned _pd_id;
unsigned _id;
Rm_client * _rm_client;
bool _main_thread;
Native_utcb * _phys_utcb;
@ -68,16 +68,14 @@ namespace Genode {
/**
* Constructor for core threads
*/
Platform_thread(const char * name,
Thread_base * const thread_base,
unsigned long const stack_size,
unsigned long const pd_id);
Platform_thread(const char * name, Thread_base * const thread_base,
size_t const stack_size, unsigned const pd_id);
/**
* Constructor for threads outside of core
*/
Platform_thread(const char * name, unsigned int priority,
addr_t utcb);
Platform_thread(const char * name, unsigned const priority,
addr_t const utcb);
/**
* Destructor
@ -93,8 +91,7 @@ namespace Genode {
* \retval 0 on success
* \retval <0 otherwise
*/
int join_pd(unsigned long const pd_id,
bool const main_thread);
int join_pd(unsigned const pd_id, bool const main_thread);
/**
* Run this thread
@ -141,7 +138,7 @@ namespace Genode {
/**
* Return unique identification of this thread as faulter
*/
unsigned long pager_object_badge() { return _id; }
unsigned pager_object_badge() { return _id; }
/**
* Set the executing CPU for this thread
@ -163,11 +160,11 @@ namespace Genode {
Pager_object * pager() const;
unsigned long pd_id() const { return _pd_id; }
unsigned pd_id() const { return _pd_id; }
Native_thread_id id() const { return _id; }
unsigned long stack_size() const { return _stack_size; }
size_t stack_size() const { return _stack_size; }
Thread_base * thread_base()
{

View File

@ -60,7 +60,7 @@ namespace Genode
Signal_context_capability
alloc_context(Signal_receiver_capability const r,
unsigned long const imprint);
unsigned const imprint);
};
}

View File

@ -96,9 +96,9 @@ namespace Genode
*/
inline void print_page_fault(const char *msg, addr_t pf_addr, addr_t pf_ip,
Rm_session::Fault_type pf_type,
unsigned long faulter_badge)
unsigned faulter_badge)
{
printf("%s (%s pf_addr=%p pf_ip=%p from %02lx)", msg,
printf("%s (%s pf_addr=%p pf_ip=%p from %02x)", msg,
pf_type == Rm_session::WRITE_FAULT ? "WRITE" : "READ",
(void *)pf_addr, (void *)pf_ip,
faulter_badge);

View File

@ -31,7 +31,7 @@ namespace Genode {
Rpc_entrypoint *_ds_ep;
Range_allocator *_ram_alloc;
unsigned long _vm_id;
unsigned _vm_id;
void *_vm;
addr_t _ds_addr;
Dataspace_component _ds;

View File

@ -52,8 +52,9 @@ Irq_session_component::Irq_session_component(Cap_session * cap_session,
}
/* allocate IRQ */
long irq_number = Arg_string::find_arg(args, "irq_number").long_value(-1);
if (irq_number == -1 || !irq_alloc ||
irq_alloc->alloc_addr(1, irq_number).is_error()) {
if (irq_number < 0 || !irq_alloc ||
irq_alloc->alloc_addr(1, irq_number).is_error())
{
PERR("Unavailable IRQ %lu requested", irq_number);
throw Root::Invalid_args();
}

View File

@ -58,9 +58,9 @@ namespace Kernel
* Copy 'size' successive bytes from 'src_base' to 'dst_base'
*/
inline void copy_range(void * const src_base, void * const dst_base,
size_t size)
size_t const size)
{
for (unsigned long off = 0; off < size; off += sizeof(umword_t))
for (size_t off = 0; off < size; off += sizeof(umword_t))
*(umword_t *)((addr_t)dst_base + off) =
*(umword_t *)((addr_t)src_base + off);
}

View File

@ -33,15 +33,11 @@ namespace Genode
namespace Kernel
{
typedef Genode::Cpu Cpu;
typedef Genode::Tlb Tlb;
typedef Genode::Page_flags Page_flags;
typedef Genode::Core_tlb Core_tlb;
typedef Genode::addr_t addr_t;
typedef Genode::size_t size_t;
typedef Genode::Signal Signal;
typedef Genode::Pagefault Pagefault;
typedef Genode::Native_utcb Native_utcb;
typedef Genode::Platform_thread Platform_thread;
template <typename T> class Avl_tree : public Genode::Avl_tree<T> { };
template <typename T> class Avl_node : public Genode::Avl_node<T> { };
@ -80,19 +76,19 @@ namespace Kernel
{
protected:
unsigned long _id;
unsigned _id;
public:
/**
* Constructors
*/
Entry(unsigned long const id) : _id(id) { }
Entry(unsigned const id) : _id(id) { }
/**
* Find entry with 'object_id' within this AVL subtree
*/
Entry * find(unsigned long const object_id)
Entry * find(unsigned const object_id)
{
if (object_id == id()) return this;
Entry * const subtree = Avl_node<Entry>::child(object_id > id());
@ -102,7 +98,7 @@ namespace Kernel
/**
* ID of this object
*/
unsigned long const id() const { return _id; }
unsigned id() const { return _id; }
/************************
@ -131,7 +127,7 @@ namespace Kernel
/**
* Lookup object
*/
Object * object(unsigned long const id)
Object * object(unsigned const id)
{
Entry * object = _tree.first();
return (Object *)(object ? object->find(id) : 0);

View File

@ -215,7 +215,7 @@ namespace Cortex_a9
} _cpu;
unsigned const _max_interrupt;
unsigned long _last_taken_request;
unsigned _last_taken_request;
public:

View File

@ -57,8 +57,7 @@ Platform_thread::~Platform_thread()
Platform_thread::Platform_thread(const char * name,
Thread_base * const thread_base,
unsigned long const stack_size,
unsigned long const pd_id)
size_t const stack_size, unsigned const pd_id)
:
_thread_base(thread_base), _stack_size(stack_size),
_pd_id(pd_id), _rm_client(0), _virt_utcb(0)
@ -103,8 +102,7 @@ Platform_thread::Platform_thread(const char * name, unsigned int priority,
}
int Platform_thread::join_pd(unsigned long const pd_id,
bool const main_thread)
int Platform_thread::join_pd(unsigned const pd_id, bool const main_thread)
{
/* check if we're already in another PD */
if (_pd_id && _pd_id != pd_id) return -1;

View File

@ -52,7 +52,7 @@ Signal_receiver_capability Signal_session_component::alloc_receiver()
size_t const s = Kernel::signal_receiver_size();
void * p;
if (!_receivers_slab.alloc(s, &p)) throw Out_of_metadata();
unsigned long const id = Kernel::new_signal_receiver(p);
unsigned const id = Kernel::new_signal_receiver(p);
if (!id) throw Out_of_metadata();
/* return reference to the new kernel-object */
@ -63,13 +63,13 @@ Signal_receiver_capability Signal_session_component::alloc_receiver()
Signal_context_capability
Signal_session_component::alloc_context(Signal_receiver_capability r,
unsigned long imprint)
unsigned imprint)
{
/* create context kernel-object */
size_t const s = Kernel::signal_context_size();
void * p;
if (!_contexts_slab.alloc(s, &p)) throw Out_of_metadata();
unsigned long const id = Kernel::new_signal_context(p, r.dst(), imprint);
unsigned const id = Kernel::new_signal_context(p, r.dst(), imprint);
if (!id) throw Out_of_metadata();
/* return reference to the new kernel-object */

View File

@ -75,9 +75,9 @@ Thread_base::~Thread_base()
void Thread_base::start()
{
size_t const stack_size = _tid->stack_size()/sizeof(unsigned long) + 1;
size_t const stack_size = _tid->stack_size()/sizeof(umword_t) + 1;
void * const stack_base = new (platform()->core_mem_alloc())
unsigned long [stack_size];
umword_t [stack_size];
void * sp = (void *)((addr_t)stack_base + _tid->stack_size());
void * ip = (void *)&thread_entry;
if (_tid->start(ip, sp)) PERR("Couldn't start thread");

View File

@ -106,15 +106,15 @@ namespace Cortex_a9
/**
* Translate milliseconds to a native timer value
*/
static uint32_t ms_to_tics(unsigned long const ms) {
static uint32_t ms_to_tics(unsigned const ms) {
return ms * TICS_PER_MS; }
/**
* Stop the timer and return last timer value
*/
unsigned long stop_one_shot()
unsigned stop_one_shot()
{
unsigned long const v = read<Counter>();
unsigned const v = read<Counter>();
_disable();
return v;
}

View File

@ -62,10 +62,8 @@ namespace Arm
/**
* Check if 'p' is aligned to 1 << 'alignm_log2'
*/
inline bool aligned(addr_t const a, unsigned long const alignm_log2)
{
return a == ((a >> alignm_log2) << alignm_log2);
}
inline bool aligned(addr_t const a, size_t const alignm_log2) {
return a == ((a >> alignm_log2) << alignm_log2); }
/**
* Common access permission [1:0] bitfield values
@ -323,7 +321,7 @@ namespace Arm
* \retval 0 on success
* \retval <0 translation failed
*/
int _index_by_vo (unsigned long & i, addr_t const vo) const
int _index_by_vo (unsigned & i, addr_t const vo) const
{
if (vo > max_virt_offset()) return -1;
i = vo >> Small_page::VIRT_SIZE_LOG2;
@ -379,11 +377,11 @@ namespace Arm
* a link to another table level.
*/
void insert_translation(addr_t const vo, addr_t const pa,
unsigned long const size_log2,
size_t const size_log2,
Page_flags::access_t const flags)
{
/* validate virtual address */
unsigned long i;
unsigned i;
if (_index_by_vo (i, vo)) {
PDBG("Invalid virtual offset");
while (1) ;
@ -428,7 +426,7 @@ namespace Arm
{
/* traverse all possibly affected entries */
addr_t residual_vo = vo;
unsigned long i;
unsigned i;
while (1)
{
/* check if anything is left over to remove */
@ -675,7 +673,7 @@ namespace Arm
* \retval <0 if virtual offset couldn't be resolved,
* in this case 'i' reside invalid
*/
int _index_by_vo(unsigned long & i, addr_t const vo) const
int _index_by_vo(unsigned & i, addr_t const vo) const
{
if (vo > max_virt_offset()) return -1;
i = vo >> Section::VIRT_SIZE_LOG2;
@ -747,17 +745,17 @@ namespace Arm
* table level.
*/
template <typename ST>
unsigned long insert_translation(addr_t const vo, addr_t const pa,
unsigned long const size_log2,
Page_flags::access_t const flags,
ST * const st,
void * const extra_space = 0)
size_t insert_translation(addr_t const vo, addr_t const pa,
size_t const size_log2,
Page_flags::access_t const flags,
ST * const st,
void * const extra_space = 0)
{
typedef typename ST::Section Section;
typedef typename ST::Page_table_descriptor Page_table_descriptor;
/* validate virtual address */
unsigned long i;
unsigned i;
if (_index_by_vo (i, vo)) {
PDBG("Invalid virtual offset");
while (1) ;
@ -830,7 +828,7 @@ namespace Arm
{
/* traverse all possibly affected entries */
addr_t residual_vo = vo;
unsigned long i;
unsigned i;
while (1)
{
/* check if anything is left over to remove */

View File

@ -66,9 +66,9 @@ namespace Arm_v6
*
* For details see 'Arm::Section_table::insert_translation'
*/
unsigned long
size_t
insert_translation(addr_t const vo, addr_t const pa,
unsigned long const size_log2,
size_t const size_log2,
Arm::Page_flags::access_t const flags,
void * const extra_space = 0) {
return Arm::Section_table::

View File

@ -83,9 +83,9 @@ namespace Arm_v7
*
* For details see 'Arm::Section_table::insert_translation'
*/
unsigned long
size_t
insert_translation(addr_t const vo, addr_t const pa,
unsigned long const size_log2,
size_t const size_log2,
Arm::Page_flags::access_t const flags,
void * const extra_space = 0) {
return Arm::Section_table::