Changeset 37c57f2 in mainline
- Timestamp:
- 2006-03-16T20:56:22Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ff14c520
- Parents:
- 6a22fcb
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/src/interrupt.c
r6a22fcb r37c57f2 46 46 { 47 47 char *symbol; 48 __u64 *x = &istate->stack[0]; 48 /* __u64 *x = &istate->stack[0]; */ 49 49 50 50 if (!(symbol=get_symtab_entry(istate->rip))) … … 61 61 printf("%%r14=%Q, %%r15=%Q, %%rsp=%Q\n",istate->r14,istate->r15,&istate->stack[0]); 62 62 printf("%%rbp=%Q\n",istate->rbp); 63 /* 63 64 printf("stack: %Q, %Q, %Q\n", x[5], x[6], x[7]); 64 65 printf(" %Q, %Q, %Q\n", x[8], x[9], x[10]); 65 66 printf(" %Q, %Q, %Q\n", x[11], x[12], x[13]); 66 67 printf(" %Q, %Q, %Q\n", x[14], x[15], x[16]); 68 */ 67 69 } 68 70 -
generic/include/ipc/ipc.h
r6a22fcb r37c57f2 100 100 * indicating that it wants to be connected to some 101 101 * service 102 * - arg1/2 are user specified, arg3 contains 103 * address of the phone that should be connected 104 * (TODO: it leaks to userspace) 102 105 * recepient - if ipc_answer == 0, then accept connection 103 106 * - otherwise connection refused … … 171 174 extern void ipc_call_init(call_t *call); 172 175 extern void ipc_forward(call_t *call, answerbox_t *newbox,answerbox_t *oldbox); 176 extern void task_print_list(void); 173 177 174 178 extern answerbox_t *ipc_phone_0; -
generic/src/console/cmd.c
r6a22fcb r37c57f2 54 54 #include <proc/scheduler.h> 55 55 #include <proc/thread.h> 56 #include <proc/task.h> 56 57 57 58 /** Data and methods for 'help' command. */ … … 254 255 }; 255 256 257 static int cmd_tasks(cmd_arg_t *argv); 258 static cmd_info_t tasks_info = { 259 .name = "tasks", 260 .description = "List all tasks", 261 .func = cmd_tasks, 262 .argc = 0 263 }; 264 256 265 257 266 static int cmd_sched(cmd_arg_t *argv); … … 339 348 &sched_info, 340 349 &threads_info, 350 &tasks_info, 341 351 &tlb_info, 342 352 &version_info, … … 629 639 } 630 640 641 /** Command for listings Task information 642 * 643 * @param argv Ignores 644 * 645 * @return Always 1 646 */ 647 int cmd_tasks(cmd_arg_t * argv) { 648 task_print_list(); 649 return 1; 650 } 651 631 652 /** Command for listings Thread information 632 653 * -
generic/src/ipc/sysipc.c
r6a22fcb r37c57f2 36 36 #include <ipc/ipc.h> 37 37 #include <ipc/sysipc.h> 38 39 38 40 #include <print.h> 41 #include <arch.h> 42 #include <proc/thread.h> 39 43 40 44 /* TODO: multi-threaded connect-to-me can cause race condition … … 138 142 { 139 143 if (IPC_GET_METHOD(call->data) == IPC_M_CONNECTTOME) 144 return 1; 145 if (IPC_GET_METHOD(call->data) == IPC_M_CONNECTMETO) 140 146 return 1; 141 147 return 0; … … 156 162 phone_connect(phoneid,&answer->sender->answerbox); 157 163 } 164 } else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECTMETO) { 165 /* If the users accepted call, connect */ 166 if (!IPC_GET_RETVAL(answer->data)) { 167 printf("Connecting Phone %P\n",IPC_GET_ARG3(*olddata)); 168 ipc_phone_connect((phone_t *)IPC_GET_ARG3(*olddata), 169 &TASK->answerbox); 170 } 158 171 } 159 172 } … … 319 332 * 320 333 * The arg1 and arg2 are changed in the forwarded message 334 * 335 * Warning: If implementing non-fast version, make sure that 336 * arg3 is not rewritten for certain system IPC 321 337 */ 322 338 __native sys_ipc_forward_fast(__native callid, __native phoneid, … … 437 453 &phone->callee->task->taskid, 438 454 sizeof(TASK->taskid)); 455 439 456 return IPC_GET_RETVAL(call.data); 440 457 } … … 449 466 call_t call; 450 467 phone_t *phone; 468 int newphid; 451 469 452 470 phone = get_phone(phoneid); 453 471 if (!phone) 454 472 return ENOENT; 473 474 newphid = phone_alloc(); 475 if (newphid < 0) 476 return ELIMIT; 455 477 456 478 ipc_call_init(&call); … … 458 480 IPC_SET_ARG1(call.data, arg1); 459 481 IPC_SET_ARG2(call.data, arg2); 482 IPC_SET_ARG3(call.data, (__native)&TASK->phones[newphid]); 460 483 461 484 ipc_call_sync(phone, &call); 462 if (!IPC_GET_RETVAL(call.data)) { 463 /* Everybody accepted, we should be connected by now */ 464 } 465 466 return 0; 485 486 if (IPC_GET_RETVAL(call.data)) { /* Connection failed */ 487 phone_dealloc(newphid); 488 return IPC_GET_RETVAL(call.data); 489 } 490 491 return newphid; 467 492 } 468 493 … … 486 511 restart: 487 512 call = ipc_wait_for_call(&TASK->answerbox, flags); 488 printf("Received call %P from sender: %P\n", call, call->sender);489 513 490 514 if (call->flags & IPC_CALL_ANSWERED) { -
generic/src/proc/task.c
r6a22fcb r37c57f2 39 39 #include <ipc/ipc.h> 40 40 #include <memstr.h> 41 #include <print.h> 41 42 42 43 #include <elf.h> … … 132 133 return task; 133 134 } 135 136 /** Print task list */ 137 void task_print_list(void) 138 { 139 link_t *cur; 140 task_t *t; 141 ipl_t ipl; 142 int i; 143 144 /* Messing with thread structures, avoid deadlock */ 145 ipl = interrupts_disable(); 146 spinlock_lock(&tasks_lock); 147 148 for (cur=tasks_head.next; cur!=&tasks_head; cur=cur->next) { 149 t = list_get_instance(cur, task_t, tasks_link); 150 spinlock_lock(&t->lock); 151 printf("Task: %Q ActiveCalls: %d", t->taskid, 152 atomic_get(&t->active_calls)); 153 for (i=0; i < IPC_MAX_PHONES; i++) { 154 if (t->phones[i].callee) 155 printf(" Ph(%d): %P ", i,t->phones[i].callee); 156 } 157 printf("\n"); 158 spinlock_unlock(&t->lock); 159 } 160 161 spinlock_unlock(&tasks_lock); 162 interrupts_restore(ipl); 163 164 } -
generic/src/proc/thread.c
r6a22fcb r37c57f2 413 413 if (t->cpu) 414 414 printf("cpu%d ", t->cpu->id); 415 416 415 printf("\n"); 417 416 } 418 417 419 418 spinlock_unlock(&threads_lock); 420 interrupts_ enable();421 } 419 interrupts_restore(ipl); 420 }
Note:
See TracChangeset
for help on using the changeset viewer.