codezero: fix compiler warnings int/unsigned

Warnings like the following:

warning: narrowing conversion of ‘((Genode::Platform_pd*)this)->Genode::Platform_pd::_space_id’ from ‘int’ to ‘Codezero::l4id_t {aka unsigned int}’ inside { } is ill-formed in C++11 [-Wnarrowing]
This commit is contained in:
Alexander Boettcher 2013-01-29 08:37:51 +01:00 committed by Norman Feske
parent 9453d319cb
commit f7c0a480da
5 changed files with 11 additions and 11 deletions

View File

@ -31,7 +31,7 @@ namespace Genode {
enum { UTCB_VIRT_BASE = 0x30000000 }; enum { UTCB_VIRT_BASE = 0x30000000 };
enum { UTCB_AREA_SIZE = MAX_THREADS_PER_PD*sizeof(struct Codezero::utcb) }; enum { UTCB_AREA_SIZE = MAX_THREADS_PER_PD*sizeof(struct Codezero::utcb) };
int _space_id; unsigned _space_id;
bool utcb_in_use[MAX_THREADS_PER_PD]; bool utcb_in_use[MAX_THREADS_PER_PD];

View File

@ -30,8 +30,8 @@ namespace Genode {
enum { PD_NAME_MAX_LEN = 64 }; enum { PD_NAME_MAX_LEN = 64 };
int _tid; /* global codezero thread ID */ unsigned _tid; /* global codezero thread ID */
int _space_id; unsigned _space_id;
addr_t _utcb; addr_t _utcb;
char _name[PD_NAME_MAX_LEN]; char _name[PD_NAME_MAX_LEN];
Pager_object *_pager; Pager_object *_pager;
@ -41,7 +41,7 @@ namespace Genode {
* *
* This function is called from 'Platform_pd::bind_thread'. * This function is called from 'Platform_pd::bind_thread'.
*/ */
void _assign_physical_thread(int tid, int space_id, addr_t utcb) { void _assign_physical_thread(unsigned tid, unsigned space_id, addr_t utcb) {
_tid = tid; _space_id = space_id; _utcb = utcb; } _tid = tid; _space_id = space_id; _utcb = utcb; }
public: public:

View File

@ -97,15 +97,15 @@ Platform_pd::Platform_pd(bool core)
} }
Platform_pd::Platform_pd(signed pd_id, bool create) : _space_id(-1) Platform_pd::Platform_pd(signed pd_id, bool create) : _space_id(TASK_ID_INVALID)
{ {
_space_id = -1; _space_id = TASK_ID_INVALID;
/* mark all UTCBs of the new PD as free */ /* mark all UTCBs of the new PD as free */
for (int i = 0; i < MAX_THREADS_PER_PD; i++) for (int i = 0; i < MAX_THREADS_PER_PD; i++)
utcb_in_use[i] = false; utcb_in_use[i] = false;
struct task_ids ids = { -1, -1, -1 }; struct task_ids ids = { TASK_ID_INVALID, TASK_ID_INVALID, TASK_ID_INVALID };
int ret = l4_thread_control(THREAD_CREATE | TC_NEW_SPACE, &ids); int ret = l4_thread_control(THREAD_CREATE | TC_NEW_SPACE, &ids);
if (ret < 0) { if (ret < 0) {

View File

@ -35,7 +35,7 @@ void Platform_thread::affinity(unsigned int cpu_no)
int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no) int Platform_thread::start(void *ip, void *sp, unsigned int cpu_no)
{ {
Native_thread_id pager = _pager ? _pager->cap().dst() : -1; Native_thread_id pager = _pager ? _pager->cap().dst() : THREAD_INVALID;
/* setup thread context */ /* setup thread context */
struct exregs_data exregs; struct exregs_data exregs;
@ -100,7 +100,7 @@ void Platform_thread::cancel_blocking()
Platform_thread::Platform_thread(const char *name, unsigned, addr_t, Platform_thread::Platform_thread(const char *name, unsigned, addr_t,
int thread_id) int thread_id)
: _tid(-1) : _tid(THREAD_INVALID)
{ {
strncpy(_name, name, sizeof(_name)); strncpy(_name, name, sizeof(_name));
} }

View File

@ -43,13 +43,13 @@ void Thread_base::_deinit_platform_thread() { }
* \return new thread ID, or * \return new thread ID, or
* negative error code * negative error code
*/ */
inline int create_thread(int space_no, inline int create_thread(unsigned space_no,
void *sp, void *ip, void *sp, void *ip,
int pager_tid = 1) int pager_tid = 1)
{ {
using namespace Codezero; using namespace Codezero;
struct task_ids ids = { 1, space_no, TASK_ID_INVALID }; struct task_ids ids = { 1U, space_no, TASK_ID_INVALID };
/* allocate new thread at the kernel */ /* allocate new thread at the kernel */
unsigned long flags = THREAD_CREATE | TC_SHARE_SPACE | TC_SHARE_GROUP; unsigned long flags = THREAD_CREATE | TC_SHARE_SPACE | TC_SHARE_GROUP;