Fixed more warnings due to the int/int32/status_t change.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1138 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2002-09-24 00:08:50 +00:00
parent e58fbc960b
commit d98c7edc06
6 changed files with 195 additions and 143 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ dbg_stack_trace(int argc, char **argv)
dprintf("iframe %p %p %p\n", temp, temp + sizeof(struct iframe), temp + sizeof(struct iframe) - 8); dprintf("iframe %p %p %p\n", temp, temp + sizeof(struct iframe), temp + sizeof(struct iframe) - 8);
} }
dprintf("stack trace for thread 0x%x '%s'\n", t->id, t->name); dprintf("stack trace for thread 0x%lx '%s'\n", t->id, t->name);
dprintf("frame \tcaller:<base function+offset>\n"); dprintf("frame \tcaller:<base function+offset>\n");
dprintf("-------------------------------\n"); dprintf("-------------------------------\n");
+2 -1
View File
@@ -2,6 +2,7 @@
** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License. ** Distributed under the terms of the NewOS License.
*/ */
#include <stage2.h> #include <stage2.h>
#include <kernel.h> #include <kernel.h>
@@ -43,7 +44,7 @@ static void clear_isa_hardware_timer()
// XXX do something here // XXX do something here
} }
static int isa_timer_interrupt(void* data) static int32 isa_timer_interrupt(void* data)
{ {
return timer_interrupt(); return timer_interrupt();
} }
+106 -52
View File
@@ -251,7 +251,7 @@ static struct thread *create_thread_struct(const char *name)
t->kernel_time = 0; t->kernel_time = 0;
t->last_time = 0; t->last_time = 0;
sprintf(temp, "thread_0x%x_retcode_sem", t->id); sprintf(temp, "thread_0x%lx_retcode_sem", t->id);
t->return_code_sem = create_sem(0, temp); t->return_code_sem = create_sem(0, temp);
if(t->return_code_sem < 0) if(t->return_code_sem < 0)
goto err1; goto err1;
@@ -323,8 +323,9 @@ static int _create_kernel_thread_kentry(void)
return func(t->args); return func(t->args);
} }
static thread_id _create_thread(const char *name, team_id pid, addr entry, void *args,
int priority, bool kernel) static thread_id
_create_thread(const char *name, team_id pid, addr entry, void *args, int priority, bool kernel)
{ {
struct thread *t; struct thread *t;
struct team *p; struct team *p;
@@ -387,7 +388,7 @@ static thread_id _create_thread(const char *name, team_id pid, addr entry, void
// until we find a spot. // until we find a spot.
t->user_stack_base = (USER_STACK_REGION - STACK_SIZE - ENV_SIZE) + USER_STACK_REGION_SIZE; t->user_stack_base = (USER_STACK_REGION - STACK_SIZE - ENV_SIZE) + USER_STACK_REGION_SIZE;
while (t->user_stack_base > USER_STACK_REGION) { while (t->user_stack_base > USER_STACK_REGION) {
sprintf(stack_name, "%s_stack%d", p->name, t->id); sprintf(stack_name, "%s_stack%ld", p->name, t->id);
t->user_stack_region_id = vm_create_anonymous_region(p->_aspace_id, stack_name, t->user_stack_region_id = vm_create_anonymous_region(p->_aspace_id, stack_name,
(void **)&t->user_stack_base, (void **)&t->user_stack_base,
REGION_ADDR_ANY_ADDRESS, STACK_SIZE, REGION_WIRING_LAZY, LOCK_RW); REGION_ADDR_ANY_ADDRESS, STACK_SIZE, REGION_WIRING_LAZY, LOCK_RW);
@@ -558,7 +559,9 @@ int thread_set_priority(thread_id id, int priority)
} }
#endif /* not NEW_SCHEDULER */ #endif /* not NEW_SCHEDULER */
static const char *state_to_text(int state)
static const char *
state_to_text(int state)
{ {
switch (state) { switch (state) {
case B_THREAD_READY: case B_THREAD_READY:
@@ -576,12 +579,14 @@ static const char *state_to_text(int state)
} }
} }
static struct thread *last_thread_dumped = NULL; static struct thread *last_thread_dumped = NULL;
static void _dump_thread_info(struct thread *t) static void
_dump_thread_info(struct thread *t)
{ {
dprintf("THREAD: %p\n", t); dprintf("THREAD: %p\n", t);
dprintf("id: 0x%x\n", t->id); dprintf("id: 0x%lx\n", t->id);
dprintf("name: '%s'\n", t->name); dprintf("name: '%s'\n", t->name);
dprintf("all_next: %p\nteam_next: %p\nq_next: %p\n", dprintf("all_next: %p\nteam_next: %p\nq_next: %p\n",
t->all_next, t->team_next, t->q_next); t->all_next, t->team_next, t->q_next);
@@ -595,7 +600,7 @@ static void _dump_thread_info(struct thread *t)
dprintf("\n"); dprintf("\n");
dprintf("pending_signals: 0x%x\n", t->pending_signals); dprintf("pending_signals: 0x%x\n", t->pending_signals);
dprintf("in_kernel: %d\n", t->in_kernel); dprintf("in_kernel: %d\n", t->in_kernel);
dprintf("sem_blocking:0x%x\n", t->sem_blocking); dprintf("sem_blocking:0x%lx\n", t->sem_blocking);
dprintf("sem_count: 0x%x\n", t->sem_count); dprintf("sem_count: 0x%x\n", t->sem_count);
dprintf("sem_deleted_retcode: 0x%x\n", t->sem_deleted_retcode); dprintf("sem_deleted_retcode: 0x%x\n", t->sem_deleted_retcode);
dprintf("sem_errcode: 0x%x\n", t->sem_errcode); dprintf("sem_errcode: 0x%x\n", t->sem_errcode);
@@ -604,10 +609,10 @@ static void _dump_thread_info(struct thread *t)
dprintf("args: %p\n", t->args); dprintf("args: %p\n", t->args);
dprintf("entry: 0x%lx\n", t->entry); dprintf("entry: 0x%lx\n", t->entry);
dprintf("team: %p\n", t->team); dprintf("team: %p\n", t->team);
dprintf("return_code_sem: 0x%x\n", t->return_code_sem); dprintf("return_code_sem: 0x%lx\n", t->return_code_sem);
dprintf("kernel_stack_region_id: 0x%x\n", t->kernel_stack_region_id); dprintf("kernel_stack_region_id: 0x%lx\n", t->kernel_stack_region_id);
dprintf("kernel_stack_base: 0x%lx\n", t->kernel_stack_base); dprintf("kernel_stack_base: 0x%lx\n", t->kernel_stack_base);
dprintf("user_stack_region_id: 0x%x\n", t->user_stack_region_id); dprintf("user_stack_region_id: 0x%lx\n", t->user_stack_region_id);
dprintf("user_stack_base: 0x%lx\n", t->user_stack_base); dprintf("user_stack_base: 0x%lx\n", t->user_stack_base);
dprintf("kernel_time: %Ld\n", t->kernel_time); dprintf("kernel_time: %Ld\n", t->kernel_time);
dprintf("user_time: %Ld\n", t->user_time); dprintf("user_time: %Ld\n", t->user_time);
@@ -617,7 +622,9 @@ static void _dump_thread_info(struct thread *t)
last_thread_dumped = t; last_thread_dumped = t;
} }
static int dump_thread_info(int argc, char **argv)
static int
dump_thread_info(int argc, char **argv)
{ {
struct thread *t; struct thread *t;
int id = -1; int id = -1;
@@ -653,7 +660,9 @@ static int dump_thread_info(int argc, char **argv)
return 0; return 0;
} }
static int dump_thread_list(int argc, char **argv)
static int
dump_thread_list(int argc, char **argv)
{ {
struct thread *t; struct thread *t;
struct hash_iterator i; struct hash_iterator i;
@@ -665,7 +674,7 @@ static int dump_thread_list(int argc, char **argv)
dprintf("\t%32s", t->name); dprintf("\t%32s", t->name);
else else
dprintf("\t%32s", "<NULL>"); dprintf("\t%32s", "<NULL>");
dprintf("\t0x%x", t->id); dprintf("\t0x%lx", t->id);
dprintf("\t%16s", state_to_text(t->state)); dprintf("\t%16s", state_to_text(t->state));
if (t->cpu) if (t->cpu)
dprintf("\t%d", t->cpu->info.cpu_num); dprintf("\t%d", t->cpu->info.cpu_num);
@@ -677,7 +686,9 @@ static int dump_thread_list(int argc, char **argv)
return 0; return 0;
} }
static int dump_next_thread_in_q(int argc, char **argv)
static int
dump_next_thread_in_q(int argc, char **argv)
{ {
struct thread *t = last_thread_dumped; struct thread *t = last_thread_dumped;
@@ -695,7 +706,9 @@ static int dump_next_thread_in_q(int argc, char **argv)
return 0; return 0;
} }
static int dump_next_thread_in_all_list(int argc, char **argv)
static int
dump_next_thread_in_all_list(int argc, char **argv)
{ {
struct thread *t = last_thread_dumped; struct thread *t = last_thread_dumped;
@@ -713,7 +726,9 @@ static int dump_next_thread_in_all_list(int argc, char **argv)
return 0; return 0;
} }
static int dump_next_thread_in_team(int argc, char **argv)
static int
dump_next_thread_in_team(int argc, char **argv)
{ {
struct thread *t = last_thread_dumped; struct thread *t = last_thread_dumped;
@@ -731,7 +746,9 @@ static int dump_next_thread_in_team(int argc, char **argv)
return 0; return 0;
} }
static int get_death_stack(void)
static int
get_death_stack(void)
{ {
int i; int i;
unsigned int bit; unsigned int bit;
@@ -747,21 +764,16 @@ static int get_death_stack(void)
death_stack_bitmap |= bit; death_stack_bitmap |= bit;
RELEASE_THREAD_LOCK(); RELEASE_THREAD_LOCK();
// sanity checks // sanity checks
if( !bit ) { if (!bit)
panic("get_death_stack: couldn't find free stack!\n"); panic("get_death_stack: couldn't find free stack!\n");
}
if( bit & (bit-1)) {
panic("get_death_stack: impossible bitmap result!\n");
}
if (bit & (bit - 1))
panic("get_death_stack: impossible bitmap result!\n");
// bit to number // bit to number
i= -1; for (i = -1; bit; i++) {
while(bit) {
bit >>= 1; bit >>= 1;
i += 1;
} }
// dprintf("get_death_stack: returning 0x%lx\n", death_stacks[i].address); // dprintf("get_death_stack: returning 0x%lx\n", death_stacks[i].address);
@@ -769,7 +781,9 @@ static int get_death_stack(void)
return i; return i;
} }
static void put_death_stack_and_reschedule(unsigned int index)
static void
put_death_stack_and_reschedule(unsigned int index)
{ {
// dprintf("put_death_stack...: passed %d\n", index); // dprintf("put_death_stack...: passed %d\n", index);
@@ -789,7 +803,9 @@ static void put_death_stack_and_reschedule(unsigned int index)
resched(); resched();
} }
int thread_init(kernel_args *ka)
int
thread_init(kernel_args *ka)
{ {
struct thread *t; struct thread *t;
unsigned int i; unsigned int i;
@@ -887,20 +903,26 @@ int thread_init(kernel_args *ka)
return 0; return 0;
} }
int thread_init_percpu(int cpu_num)
int
thread_init_percpu(int cpu_num)
{ {
arch_thread_set_current_thread(idle_threads[cpu_num]); arch_thread_set_current_thread(idle_threads[cpu_num]);
return 0; return 0;
} }
status_t snooze(bigtime_t timeout)
status_t
snooze(bigtime_t timeout)
{ {
return acquire_sem_etc(snooze_sem, 1, B_TIMEOUT | B_CAN_INTERRUPT, return acquire_sem_etc(snooze_sem, 1, B_TIMEOUT | B_CAN_INTERRUPT, timeout);
timeout);
} }
// this function gets run by a new thread before anything else // this function gets run by a new thread before anything else
static void thread_entry(void)
static void
thread_entry(void)
{ {
// simulates the thread spinlock release that would occur if the thread had been // simulates the thread spinlock release that would occur if the thread had been
// rescheded from. The resched didn't happen because the thread is new. // rescheded from. The resched didn't happen because the thread is new.
@@ -908,7 +930,9 @@ static void thread_entry(void)
enable_interrupts(); // this essentially simulates a return-from-interrupt enable_interrupts(); // this essentially simulates a return-from-interrupt
} }
// used to pass messages between thread_exit and thread_exit2 // used to pass messages between thread_exit and thread_exit2
struct thread_exit_args { struct thread_exit_args {
struct thread *t; struct thread *t;
region_id old_kernel_stack; region_id old_kernel_stack;
@@ -917,7 +941,9 @@ struct thread_exit_args {
sem_id death_sem; sem_id death_sem;
}; };
static void thread_exit2(void *_args)
static void
thread_exit2(void *_args)
{ {
struct thread_exit_args args; struct thread_exit_args args;
// char *temp; // char *temp;
@@ -959,7 +985,9 @@ static void thread_exit2(void *_args)
panic("thread_exit2: made it where it shouldn't have!\n"); panic("thread_exit2: made it where it shouldn't have!\n");
} }
void thread_exit(int retcode)
void
thread_exit(int retcode)
{ {
int state; int state;
struct thread *t = thread_get_current_thread(); struct thread *t = thread_get_current_thread();
@@ -968,7 +996,7 @@ void thread_exit(int retcode)
unsigned int death_stack; unsigned int death_stack;
sem_id cached_death_sem; sem_id cached_death_sem;
dprintf("thread 0x%x exiting w/return code 0x%x\n", t->id, retcode); dprintf("thread 0x%lx exiting w/return code 0x%x\n", t->id, retcode);
// boost our priority to get this over with // boost our priority to get this over with
thread_set_priority(t->id, B_FIRST_REAL_TIME_PRIORITY); thread_set_priority(t->id, B_FIRST_REAL_TIME_PRIORITY);
@@ -1012,10 +1040,10 @@ void thread_exit(int retcode)
struct thread *temp_thread; struct thread *temp_thread;
char death_sem_name[SYS_MAX_OS_NAME_LEN]; char death_sem_name[SYS_MAX_OS_NAME_LEN];
sprintf(death_sem_name, "team %d death sem", p->id); sprintf(death_sem_name, "team %ld death sem", p->id);
p->death_sem = create_sem(0, death_sem_name); p->death_sem = create_sem(0, death_sem_name);
if (p->death_sem < 0) if (p->death_sem < 0)
panic("thread_exit: cannot init death sem for team %d\n", p->id); panic("thread_exit: cannot init death sem for team %ld\n", p->id);
state = disable_interrupts(); state = disable_interrupts();
GRAB_TEAM_LOCK(); GRAB_TEAM_LOCK();
@@ -1081,7 +1109,9 @@ void thread_exit(int retcode)
panic("never can get here\n"); panic("never can get here\n");
} }
static int _thread_kill_thread(thread_id id, bool wait_on)
static int
_thread_kill_thread(thread_id id, bool wait_on)
{ {
int state; int state;
struct thread *t; struct thread *t;
@@ -1118,22 +1148,30 @@ static int _thread_kill_thread(thread_id id, bool wait_on)
return rc; return rc;
} }
int thread_kill_thread(thread_id id)
int
thread_kill_thread(thread_id id)
{ {
return _thread_kill_thread(id, true); return _thread_kill_thread(id, true);
} }
int thread_kill_thread_nowait(thread_id id)
int
thread_kill_thread_nowait(thread_id id)
{ {
return _thread_kill_thread(id, false); return _thread_kill_thread(id, false);
} }
static void thread_kthread_exit(void)
static void
thread_kthread_exit(void)
{ {
thread_exit(0); thread_exit(0);
} }
int user_thread_wait_on_thread(thread_id id, int *uretcode)
int
user_thread_wait_on_thread(thread_id id, int *uretcode)
{ {
int retcode; int retcode;
int rc, rc2; int rc, rc2;
@@ -1150,7 +1188,9 @@ int user_thread_wait_on_thread(thread_id id, int *uretcode)
return rc; return rc;
} }
int thread_wait_on_thread(thread_id id, int *retcode)
int
thread_wait_on_thread(thread_id id, int *retcode)
{ {
sem_id sem; sem_id sem;
int state; int state;
@@ -1180,7 +1220,7 @@ int thread_wait_on_thread(thread_id id, int *retcode)
state = disable_interrupts(); state = disable_interrupts();
GRAB_THREAD_LOCK(); GRAB_THREAD_LOCK();
t = thread_get_current_thread(); t = thread_get_current_thread();
dprintf("thread_wait_on_thread: thread %d got return code 0x%x\n", dprintf("thread_wait_on_thread: thread %ld got return code 0x%x\n",
t->id, t->sem_deleted_retcode); t->id, t->sem_deleted_retcode);
*retcode = t->sem_deleted_retcode; *retcode = t->sem_deleted_retcode;
RELEASE_THREAD_LOCK(); RELEASE_THREAD_LOCK();
@@ -1191,7 +1231,9 @@ int thread_wait_on_thread(thread_id id, int *retcode)
return rc; return rc;
} }
struct thread *thread_get_thread_struct(thread_id id)
struct thread *
thread_get_thread_struct(thread_id id)
{ {
struct thread *t; struct thread *t;
int state; int state;
@@ -1220,9 +1262,12 @@ struct thread *thread_get_thread_struct_locked(thread_id id)
return hash_lookup(thread_hash, &key); return hash_lookup(thread_hash, &key);
} }
// sets the pending signal flag on a thread and possibly does some work to wake it up, etc. // sets the pending signal flag on a thread and possibly does some work to wake it up, etc.
// expects the thread lock to be held // expects the thread lock to be held
static void deliver_signal(struct thread *t, int signal)
static void
deliver_signal(struct thread *t, int signal)
{ {
// dprintf("deliver_signal: thread %p (%d), signal %d\n", t, t->id, signal); // dprintf("deliver_signal: thread %p (%d), signal %d\n", t, t->id, signal);
switch (signal) { switch (signal) {
@@ -1247,8 +1292,11 @@ static void deliver_signal(struct thread *t, int signal)
} }
} }
// expects the thread lock to be held // expects the thread lock to be held
static void _check_for_thread_sigs(struct thread *t, int state)
static void
_check_for_thread_sigs(struct thread *t, int state)
{ {
if (t->pending_signals == SIG_NONE) if (t->pending_signals == SIG_NONE)
return; return;
@@ -1269,8 +1317,11 @@ static void _check_for_thread_sigs(struct thread *t, int state)
} }
} }
// called in the int handler code when a thread enters the kernel for any reason // called in the int handler code when a thread enters the kernel for any reason
void thread_atkernel_entry(void)
void
thread_atkernel_entry(void)
{ {
int state; int state;
struct thread *t; struct thread *t;
@@ -1297,8 +1348,11 @@ void thread_atkernel_entry(void)
restore_interrupts(state); restore_interrupts(state);
} }
// called when a thread exits kernel space to user space // called when a thread exits kernel space to user space
void thread_atkernel_exit(void)
void
thread_atkernel_exit(void)
{ {
int state; int state;
struct thread *t; struct thread *t;
@@ -1464,7 +1518,7 @@ has_data(thread_id thread)
if (get_sem_count(thread_get_current_thread()->msg.read_sem, &count) != B_OK) if (get_sem_count(thread_get_current_thread()->msg.read_sem, &count) != B_OK)
return false; return false;
return (count == 0 ? false : true); return count == 0 ? false : true;
} }
+19 -22
View File
@@ -38,9 +38,6 @@
#define ROUNDUP(a, b) (((a) + ((b)-1)) & ~((b)-1)) #define ROUNDUP(a, b) (((a) + ((b)-1)) & ~((b)-1))
#define ROUNDOWN(a, b) (((a) / (b)) * (b)) #define ROUNDOWN(a, b) (((a) / (b)) * (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
static vm_address_space *kernel_aspace; static vm_address_space *kernel_aspace;
#define REGION_HASH_TABLE_SIZE 1024 #define REGION_HASH_TABLE_SIZE 1024
@@ -914,7 +911,7 @@ static int _vm_delete_region(vm_address_space *aspace, region_id rid)
// vm_region *temp, *last = NULL; // vm_region *temp, *last = NULL;
vm_region *region; vm_region *region;
dprintf("vm_delete_region: aspace id 0x%x, region id 0x%x\n", aspace->id, rid); dprintf("vm_delete_region: aspace id 0x%lx, region id 0x%lx\n", aspace->id, rid);
region = vm_get_region_by_id(rid); region = vm_get_region_by_id(rid);
if(region == NULL) if(region == NULL)
@@ -1131,7 +1128,7 @@ static int display_mem(int argc, char **argv)
dprintf(" 0x%04x", *((uint16 *)address + i)); dprintf(" 0x%04x", *((uint16 *)address + i));
break; break;
case 4: case 4:
dprintf(" 0x%08x", *((uint32 *)address + i)); dprintf(" 0x%08lx", *((uint32 *)address + i));
break; break;
default: default:
dprintf("huh?\n"); dprintf("huh?\n");
@@ -1161,17 +1158,17 @@ static int dump_cache_ref(int argc, char **argv)
dprintf("cache_ref at %p:\n", cache_ref); dprintf("cache_ref at %p:\n", cache_ref);
dprintf("cache: %p\n", cache_ref->cache); dprintf("cache: %p\n", cache_ref->cache);
dprintf("lock.holder: %d\n", cache_ref->lock.holder); dprintf("lock.holder: %ld\n", cache_ref->lock.holder);
dprintf("lock.sem: 0x%x\n", cache_ref->lock.sem); dprintf("lock.sem: 0x%lx\n", cache_ref->lock.sem);
dprintf("region_list:\n"); dprintf("region_list:\n");
for(region = cache_ref->region_list; region != NULL; region = region->cache_next) { for(region = cache_ref->region_list; region != NULL; region = region->cache_next) {
dprintf(" region 0x%x: ", region->id); dprintf(" region 0x%lx: ", region->id);
dprintf("base_addr = 0x%lx ", region->base); dprintf("base_addr = 0x%lx ", region->base);
dprintf("size = 0x%lx ", region->size); dprintf("size = 0x%lx ", region->size);
dprintf("name = '%s' ", region->name); dprintf("name = '%s' ", region->name);
dprintf("lock = 0x%x\n", region->lock); dprintf("lock = 0x%x\n", region->lock);
} }
dprintf("ref_count: %d\n", cache_ref->ref_count); dprintf("ref_count: %ld\n", cache_ref->ref_count);
return 0; return 0;
} }
@@ -1229,7 +1226,7 @@ static int dump_cache(int argc, char **argv)
for(page = cache->page_list; page != NULL; page = page->cache_next) { for(page = cache->page_list; page != NULL; page = page->cache_next) {
// XXX offset is 64-bit // XXX offset is 64-bit
if(page->type == PAGE_TYPE_PHYSICAL) if(page->type == PAGE_TYPE_PHYSICAL)
dprintf(" %p ppn 0x%lx offset 0x%Lx type %d state %d (%s) ref_count %d\n", dprintf(" %p ppn 0x%lx offset 0x%Lx type %d state %d (%s) ref_count %ld\n",
page, page->ppn, page->offset, page->type, page->state, page_state_to_text(page->state), page->ref_count); page, page->ppn, page->offset, page->type, page->state, page_state_to_text(page->state), page->ref_count);
else if(page->type == PAGE_TYPE_DUMMY) else if(page->type == PAGE_TYPE_DUMMY)
dprintf(" %p DUMMY PAGE state %d (%s)\n", page, page->state, page_state_to_text(page->state)); dprintf(" %p DUMMY PAGE state %d (%s)\n", page, page->state, page_state_to_text(page->state));
@@ -1243,12 +1240,12 @@ static void _dump_region(vm_region *region)
{ {
dprintf("dump of region at %p:\n", region); dprintf("dump of region at %p:\n", region);
dprintf("name: '%s'\n", region->name); dprintf("name: '%s'\n", region->name);
dprintf("id: 0x%x\n", region->id); dprintf("id: 0x%lx\n", region->id);
dprintf("base: 0x%lx\n", region->base); dprintf("base: 0x%lx\n", region->base);
dprintf("size: 0x%lx\n", region->size); dprintf("size: 0x%lx\n", region->size);
dprintf("lock: 0x%x\n", region->lock); dprintf("lock: 0x%x\n", region->lock);
dprintf("wiring: 0x%x\n", region->wiring); dprintf("wiring: 0x%x\n", region->wiring);
dprintf("ref_count: %d\n", region->ref_count); dprintf("ref_count: %ld\n", region->ref_count);
dprintf("cache_ref: %p\n", region->cache_ref); dprintf("cache_ref: %p\n", region->cache_ref);
// XXX 64-bit // XXX 64-bit
dprintf("cache_offset: 0x%Lx\n", region->cache_offset); dprintf("cache_offset: 0x%Lx\n", region->cache_offset);
@@ -1331,7 +1328,7 @@ static int dump_region_list(int argc, char **argv)
hash_open(region_table, &iter); hash_open(region_table, &iter);
while((region = hash_next(region_table, &iter)) != NULL) { while((region = hash_next(region_table, &iter)) != NULL) {
dprintf("%p\t0x%x\t%32s\t0x%lx\t\t0x%lx\t%d\t%d\n", dprintf("%p\t0x%lx\t%32s\t0x%lx\t\t0x%lx\t%d\t%d\n",
region, region->id, region->name, region->base, region->size, region->lock, region->wiring); region, region->id, region->name, region->base, region->size, region->lock, region->wiring);
} }
hash_close(region_table, &iter, false); hash_close(region_table, &iter, false);
@@ -1344,19 +1341,19 @@ static void _dump_aspace(vm_address_space *aspace)
dprintf("dump of address space at %p:\n", aspace); dprintf("dump of address space at %p:\n", aspace);
dprintf("name: '%s'\n", aspace->name); dprintf("name: '%s'\n", aspace->name);
dprintf("id: 0x%x\n", aspace->id); dprintf("id: 0x%lx\n", aspace->id);
dprintf("ref_count: %d\n", aspace->ref_count); dprintf("ref_count: %ld\n", aspace->ref_count);
dprintf("fault_count: %d\n", aspace->fault_count); dprintf("fault_count: %ld\n", aspace->fault_count);
dprintf("working_set_size: 0x%lx\n", aspace->working_set_size); dprintf("working_set_size: 0x%lx\n", aspace->working_set_size);
dprintf("translation_map: %p\n", &aspace->translation_map); dprintf("translation_map: %p\n", &aspace->translation_map);
dprintf("virtual_map.base: 0x%lx\n", aspace->virtual_map.base); dprintf("virtual_map.base: 0x%lx\n", aspace->virtual_map.base);
dprintf("virtual_map.size: 0x%lx\n", aspace->virtual_map.size); dprintf("virtual_map.size: 0x%lx\n", aspace->virtual_map.size);
dprintf("virtual_map.change_count: 0x%x\n", aspace->virtual_map.change_count); dprintf("virtual_map.change_count: 0x%x\n", aspace->virtual_map.change_count);
dprintf("virtual_map.sem: 0x%x\n", aspace->virtual_map.sem); dprintf("virtual_map.sem: 0x%lx\n", aspace->virtual_map.sem);
dprintf("virtual_map.region_hint: %p\n", aspace->virtual_map.region_hint); dprintf("virtual_map.region_hint: %p\n", aspace->virtual_map.region_hint);
dprintf("virtual_map.region_list:\n"); dprintf("virtual_map.region_list:\n");
for(region = aspace->virtual_map.region_list; region != NULL; region = region->aspace_next) { for(region = aspace->virtual_map.region_list; region != NULL; region = region->aspace_next) {
dprintf(" region 0x%x: ", region->id); dprintf(" region 0x%lx: ", region->id);
dprintf("base_addr = 0x%lx ", region->base); dprintf("base_addr = 0x%lx ", region->base);
dprintf("size = 0x%lx ", region->size); dprintf("size = 0x%lx ", region->size);
dprintf("name = '%s' ", region->name); dprintf("name = '%s' ", region->name);
@@ -1409,7 +1406,7 @@ static int dump_aspace_list(int argc, char **argv)
hash_open(aspace_table, &iter); hash_open(aspace_table, &iter);
while((as = hash_next(aspace_table, &iter)) != NULL) { while((as = hash_next(aspace_table, &iter)) != NULL) {
dprintf("%p\t0x%x\t%32s\t0x%lx\t\t0x%lx\n", dprintf("%p\t0x%lx\t%32s\t0x%lx\t\t0x%lx\n",
as, as->id, as->name, as->virtual_map.base, as->virtual_map.size); as, as->id, as->name, as->virtual_map.base, as->virtual_map.size);
} }
hash_close(aspace_table, &iter, false); hash_close(aspace_table, &iter, false);
@@ -1541,7 +1538,7 @@ int vm_delete_aspace(aspace_id aid)
if(aspace == NULL) if(aspace == NULL)
return ERR_VM_INVALID_ASPACE; return ERR_VM_INVALID_ASPACE;
dprintf("vm_delete_aspace: called on aspace 0x%x\n", aid); dprintf("vm_delete_aspace: called on aspace 0x%lx\n", aid);
// put this aspace in the deletion state // put this aspace in the deletion state
// this guarantees that no one else will add regions to the list // this guarantees that no one else will add regions to the list
@@ -1810,7 +1807,7 @@ int vm_page_fault(addr address, addr fault_address, bool is_write, bool is_user,
err = vm_soft_fault(address, is_write, is_user); err = vm_soft_fault(address, is_write, is_user);
if(err < 0) { if(err < 0) {
dprintf("vm_page_fault: vm_soft_fault returned error %d on fault at 0x%lx, ip 0x%lx, write %d, user %d, thread 0x%x\n", dprintf("vm_page_fault: vm_soft_fault returned error %d on fault at 0x%lx, ip 0x%lx, write %d, user %d, thread 0x%lx\n",
err, address, fault_address, is_write, is_user, thread_get_current_thread_id()); err, address, fault_address, is_write, is_user, thread_get_current_thread_id());
if(!is_user) { if(!is_user) {
struct thread *t = thread_get_current_thread(); struct thread *t = thread_get_current_thread();
@@ -1825,7 +1822,7 @@ int vm_page_fault(addr address, addr fault_address, bool is_write, bool is_user,
address, fault_address); address, fault_address);
} }
} else { } else {
dprintf("vm_page_fault: killing team 0x%x\n", thread_get_current_thread()->team->id); dprintf("vm_page_fault: killing team 0x%lx\n", thread_get_current_thread()->team->id);
team_kill_team(thread_get_current_thread()->team->id); team_kill_team(thread_get_current_thread()->team->id);
} }
} }
+10 -10
View File
@@ -28,7 +28,7 @@ void vm_test()
REGION_ADDR_ANY_ADDRESS, PAGE_SIZE * 16, REGION_WIRING_LAZY, LOCK_RW|LOCK_KERNEL); REGION_ADDR_ANY_ADDRESS, PAGE_SIZE * 16, REGION_WIRING_LAZY, LOCK_RW|LOCK_KERNEL);
if(region < 0) if(region < 0)
panic("vm_test 1: failed to create test region\n"); panic("vm_test 1: failed to create test region\n");
dprintf("region = 0x%x, addr = 0x%lx\n", region, region_addr); dprintf("region = 0x%lx, addr = 0x%lx\n", region, region_addr);
memset((void *)region_addr, 0, PAGE_SIZE * 16); memset((void *)region_addr, 0, PAGE_SIZE * 16);
@@ -52,7 +52,7 @@ void vm_test()
panic("vm_test 2: failed to create test region\n"); panic("vm_test 2: failed to create test region\n");
vm_get_region_info(region, &info); vm_get_region_info(region, &info);
dprintf("region = 0x%x, addr = %p, region->base = 0x%lx\n", region, ptr, info.base); dprintf("region = 0x%lx, addr = %p, region->base = 0x%lx\n", region, ptr, info.base);
if((addr)ptr != info.base) if((addr)ptr != info.base)
panic("vm_test 2: info returned about region does not match pointer returned\n"); panic("vm_test 2: info returned about region does not match pointer returned\n");
@@ -102,13 +102,13 @@ void vm_test()
region = vm_find_region_by_name(vm_get_kernel_aspace_id(), "vid_mem"); region = vm_find_region_by_name(vm_get_kernel_aspace_id(), "vid_mem");
if(region < 0) if(region < 0)
panic("vm_test 4: error finding region 'vid_mem'\n"); panic("vm_test 4: error finding region 'vid_mem'\n");
dprintf("vid_mem region = 0x%x\n", region); dprintf("vid_mem region = 0x%lx\n", region);
region2 = vm_clone_region(vm_get_kernel_aspace_id(), "vid_mem2", region2 = vm_clone_region(vm_get_kernel_aspace_id(), "vid_mem2",
&ptr, REGION_ADDR_ANY_ADDRESS, region, REGION_NO_PRIVATE_MAP, LOCK_RW|LOCK_KERNEL); &ptr, REGION_ADDR_ANY_ADDRESS, region, REGION_NO_PRIVATE_MAP, LOCK_RW|LOCK_KERNEL);
if(region2 < 0) if(region2 < 0)
panic("vm_test 4: error cloning region 'vid_mem'\n"); panic("vm_test 4: error cloning region 'vid_mem'\n");
dprintf("region2 = 0x%x, ptr = %p\n", region2, ptr); dprintf("region2 = 0x%lx, ptr = %p\n", region2, ptr);
vm_get_region_info(region, &info); vm_get_region_info(region, &info);
rc = memcmp(ptr, (void *)info.base, info.size); rc = memcmp(ptr, (void *)info.base, info.size);
@@ -131,13 +131,13 @@ void vm_test()
region = vm_find_region_by_name(vm_get_kernel_aspace_id(), "vid_mem"); region = vm_find_region_by_name(vm_get_kernel_aspace_id(), "vid_mem");
if(region < 0) if(region < 0)
panic("vm_test 5: error finding region 'vid_mem'\n"); panic("vm_test 5: error finding region 'vid_mem'\n");
dprintf("vid_mem region = 0x%x\n", region); dprintf("vid_mem region = 0x%lx\n", region);
region2 = vm_clone_region(vm_get_kernel_aspace_id(), "vid_mem3", region2 = vm_clone_region(vm_get_kernel_aspace_id(), "vid_mem3",
&ptr, REGION_ADDR_ANY_ADDRESS, region, REGION_NO_PRIVATE_MAP, LOCK_RO|LOCK_KERNEL); &ptr, REGION_ADDR_ANY_ADDRESS, region, REGION_NO_PRIVATE_MAP, LOCK_RO|LOCK_KERNEL);
if(region2 < 0) if(region2 < 0)
panic("vm_test 5: error cloning region 'vid_mem'\n"); panic("vm_test 5: error cloning region 'vid_mem'\n");
dprintf("region2 = 0x%x, ptr = %p\n", region2, ptr); dprintf("region2 = 0x%lx, ptr = %p\n", region2, ptr);
vm_get_region_info(region, &info); vm_get_region_info(region, &info);
rc = memcmp(ptr, (void *)info.base, info.size); rc = memcmp(ptr, (void *)info.base, info.size);
@@ -162,7 +162,7 @@ void vm_test()
REGION_ADDR_ANY_ADDRESS, PAGE_SIZE * 16, REGION_WIRING_LAZY, LOCK_RW|LOCK_KERNEL); REGION_ADDR_ANY_ADDRESS, PAGE_SIZE * 16, REGION_WIRING_LAZY, LOCK_RW|LOCK_KERNEL);
if(region < 0) if(region < 0)
panic("vm_test 6: error creating test region\n"); panic("vm_test 6: error creating test region\n");
dprintf("region = 0x%x, addr = %p\n", region, region_addr); dprintf("region = 0x%lx, addr = %p\n", region, region_addr);
memset(region_addr, 99, PAGE_SIZE * 16); memset(region_addr, 99, PAGE_SIZE * 16);
@@ -172,7 +172,7 @@ void vm_test()
&ptr, REGION_ADDR_ANY_ADDRESS, region, REGION_NO_PRIVATE_MAP, LOCK_RW|LOCK_KERNEL); &ptr, REGION_ADDR_ANY_ADDRESS, region, REGION_NO_PRIVATE_MAP, LOCK_RW|LOCK_KERNEL);
if(region2 < 0) if(region2 < 0)
panic("vm_test 6: error cloning test region\n"); panic("vm_test 6: error cloning test region\n");
dprintf("region2 = 0x%x, ptr = %p\n", region2, ptr); dprintf("region2 = 0x%lx, ptr = %p\n", region2, ptr);
rc = memcmp(region_addr, ptr, PAGE_SIZE * 16); rc = memcmp(region_addr, ptr, PAGE_SIZE * 16);
if(rc != 0) if(rc != 0)
@@ -231,7 +231,7 @@ void vm_test()
REGION_ADDR_ANY_ADDRESS, PAGE_SIZE * 16, REGION_WIRING_LAZY, LOCK_RW|LOCK_KERNEL); REGION_ADDR_ANY_ADDRESS, PAGE_SIZE * 16, REGION_WIRING_LAZY, LOCK_RW|LOCK_KERNEL);
if(region < 0) if(region < 0)
panic("vm_test 8: error creating test region\n"); panic("vm_test 8: error creating test region\n");
dprintf("region = 0x%x, addr = %p\n", region, region_addr); dprintf("region = 0x%lx, addr = %p\n", region, region_addr);
dprintf("vm_test 8: memsetting the first 2 pages\n"); dprintf("vm_test 8: memsetting the first 2 pages\n");
@@ -243,7 +243,7 @@ void vm_test()
&ptr, REGION_ADDR_ANY_ADDRESS, region, REGION_PRIVATE_MAP, LOCK_RW|LOCK_KERNEL); &ptr, REGION_ADDR_ANY_ADDRESS, region, REGION_PRIVATE_MAP, LOCK_RW|LOCK_KERNEL);
if(region2 < 0) if(region2 < 0)
panic("vm_test 8: error cloning test region\n"); panic("vm_test 8: error cloning test region\n");
dprintf("region2 = 0x%x, ptr = %p\n", region2, ptr); dprintf("region2 = 0x%lx, ptr = %p\n", region2, ptr);
dprintf("vm_test 8: comparing first 2 pages, shoudld be identical\n"); dprintf("vm_test 8: comparing first 2 pages, shoudld be identical\n");
@@ -152,25 +152,25 @@ static void tab(void)
pos = origin + ((y * columns + x) << 1); pos = origin + ((y * columns + x) << 1);
} }
static int console_open(const char *name, uint32 flags, void **cookie) static status_t console_open(const char *name, uint32 flags, void **cookie)
{ {
// dprintf("console_open\n"); // dprintf("console_open\n");
return 0; return 0;
} }
static int console_freecookie(void * cookie) static status_t console_freecookie(void * cookie)
{ {
return 0; return 0;
} }
static int console_seek(void * cookie, off_t pos, int st) static status_t console_seek(void * cookie, off_t pos, int st)
{ {
// dprintf("console_seek: entry\n"); // dprintf("console_seek: entry\n");
return EPERM; return EPERM;
} }
static int console_close(void * cookie) static status_t console_close(void * cookie)
{ {
// dprintf("console_close: entry\n"); // dprintf("console_close: entry\n");
@@ -235,7 +235,7 @@ static ssize_t console_write(void * cookie, off_t pos, const void *buf, size_t *
return err; return err;
} }
static int console_ioctl(void * cookie, uint32 op, void *buf, size_t len) static status_t console_ioctl(void * cookie, uint32 op, void *buf, size_t len)
{ {
int err; int err;