]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/ddb/db_task_thread.c
xnu-1228.tar.gz
[apple/xnu.git] / osfmk / ddb / db_task_thread.c
index 01eca330e549714f02b56de89b98c8d5f076d721..7e7420c14c304bed7e2c49a565ed3227ec7ef89e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -98,15 +98,11 @@ db_lookup_task(task_t target_task)
 {
        register task_t task;
        register int task_id;
-       register processor_set_t pset = &default_pset;
-       register int npset = 0;
 
        task_id = 0;
-       if (npset++ >= DB_MAX_PSETS)
+       if (queue_first(&tasks) == 0)
                return(-1);
-       if (queue_first(&pset->tasks) == 0)
-               return(-1);
-       queue_iterate(&pset->tasks, task, task_t, pset_tasks) {
+       queue_iterate(&tasks, task, task_t, tasks) {
                if (target_task == task)
                    return(task_id);
                if (task_id++ >= DB_MAX_TASKID)
@@ -147,15 +143,11 @@ db_lookup_act(thread_t target_act)
 {
        register int act_id;
        register task_t task;
-       register processor_set_t pset = &default_pset;
        register int ntask = 0;
-       register int npset = 0;
 
-       if (npset++ >= DB_MAX_PSETS)
-               return(-1);
-       if (queue_first(&pset->tasks) == 0)
+       if (queue_first(&tasks) == 0)
                return(-1);
-       queue_iterate(&pset->tasks, task, task_t, pset_tasks) {
+       queue_iterate(&tasks, task, task_t, tasks) {
                if (ntask++ > DB_MAX_TASKID)
                    return(-1);
                if (task->thread_count == 0)
@@ -186,19 +178,15 @@ db_check_act_address_valid(thread_t thr_act)
  * convert task_id(queue postion) to task address
  */
 task_t
-db_lookup_task_id(register task_id)
+db_lookup_task_id(int task_id)
 {
        register task_t task;
-       register processor_set_t pset = &default_pset;
-       register int npset = 0;
 
        if (task_id > DB_MAX_TASKID)
            return(TASK_NULL);
-       if (npset++ >= DB_MAX_PSETS)
-               return(TASK_NULL);
-       if (queue_first(&pset->tasks) == 0)
+       if (queue_first(&tasks) == 0)
                return(TASK_NULL);
-       queue_iterate(&pset->tasks, task, task_t, pset_tasks) {
+       queue_iterate(&tasks, task, task_t, tasks) {
                if (task_id-- <= 0)
                        return(task);
        }
@@ -241,7 +229,7 @@ db_get_next_act(
 
        *actp = THREAD_NULL;
        if (db_expression(&value)) {
-           thr_act = (thread_t) value;
+           thr_act = (thread_t)(unsigned long)value;
            if (!db_check_act_address_valid(thr_act)) {
                db_flush_lex();
                return(FALSE);
@@ -273,11 +261,8 @@ db_init_default_act(void)
  * in the command line
  */
 int
-db_set_default_act(
-       struct db_variable      *vp,
-       db_expr_t               *valuep,
-       int                     flag,
-       db_var_aux_param_t      ap)                     /* unused */
+db_set_default_act(__unused struct db_variable *vp, db_expr_t *valuep,
+                  int flag, __unused db_var_aux_param_t ap)
 {
        thread_t        thr_act;
        int             task_id;
@@ -296,10 +281,10 @@ db_set_default_act(
        }
 
        if (flag != DB_VAR_SET) {
-           *valuep = (db_expr_t) db_default_act;
+           *valuep = (db_expr_t)(unsigned long)db_default_act;
            return(0);
        }
-       thr_act = (thread_t) *valuep;
+       thr_act = (thread_t)(unsigned long)*valuep;
        if (thr_act != THREAD_NULL && !db_check_act_address_valid(thr_act))
            db_error(0);
            /* NOTREACHED */
@@ -313,11 +298,8 @@ db_set_default_act(
  * convert $taskXXX[.YYY] type DDB variable to task or thread address
  */
 int
-db_get_task_act(
-       struct db_variable      *vp,
-       db_expr_t               *valuep,
-       int                     flag,
-       db_var_aux_param_t      ap)
+db_get_task_act(__unused struct db_variable *vp, db_expr_t *valuep, int flag,
+               db_var_aux_param_t ap)
 {
        task_t                  task;
        thread_t                thr_act;
@@ -341,7 +323,7 @@ db_get_task_act(
            /* NOTREACHED */
        }
        if (ap->level <= 1) {
-           *valuep = (db_expr_t) task;
+           *valuep = (db_expr_t)(unsigned long)task;
            return(0);
        }
        if ((thr_act = db_lookup_act_id(task, ap->suffix[1])) == THREAD_NULL){
@@ -350,6 +332,6 @@ db_get_task_act(
            db_error(0);
            /* NOTREACHED */
        }
-       *valuep = (db_expr_t) thr_act;
+       *valuep = (db_expr_t)(unsigned long)thr_act;
        return(0);
 }