Changeset e5dbbe5 in mainline for kernel/generic/src/console/cmd.c
- Timestamp:
- 2007-04-08T23:45:41Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 72bcb25
- Parents:
- 7cb567cd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/cmd.c
r7cb567cd re5dbbe5 193 193 194 194 /* Data and methods for 'call0' command. */ 195 static char call0_buf[MAX_CMDLINE +1];196 static char carg1_buf[MAX_CMDLINE +1];197 static char carg2_buf[MAX_CMDLINE +1];198 static char carg3_buf[MAX_CMDLINE +1];195 static char call0_buf[MAX_CMDLINE + 1]; 196 static char carg1_buf[MAX_CMDLINE + 1]; 197 static char carg2_buf[MAX_CMDLINE + 1]; 198 static char carg3_buf[MAX_CMDLINE + 1]; 199 199 200 200 static int cmd_call0(cmd_arg_t *argv); … … 210 210 .argc = 1, 211 211 .argv = &call0_argv 212 }; 213 214 /* Data and methods for 'mcall0' command. */ 215 static int cmd_mcall0(cmd_arg_t *argv); 216 static cmd_arg_t mcall0_argv = { 217 .type = ARG_TYPE_STRING, 218 .buffer = call0_buf, 219 .len = sizeof(call0_buf) 220 }; 221 static cmd_info_t mcall0_info = { 222 .name = "mcall0", 223 .description = "mcall0 <function> -> call function() on each CPU.", 224 .func = cmd_mcall0, 225 .argc = 1, 226 .argv = &mcall0_argv 212 227 }; 213 228 … … 407 422 static cmd_info_t *basic_commands[] = { 408 423 &call0_info, 424 &mcall0_info, 409 425 &call1_info, 410 426 &call2_info, … … 541 557 unative_t f; 542 558 unative_t gp; 543 } fptr;559 } fptr; 544 560 #endif 545 561 … … 552 568 } else { 553 569 symbol = get_symtab_entry(symaddr); 554 printf("Calling f(): %.*p: %s\n", sizeof(uintptr_t) * 2, symaddr, symbol);570 printf("Calling %s() (%.*p)\n", symbol, sizeof(uintptr_t) * 2, symaddr); 555 571 #ifdef ia64 556 572 fptr.f = symaddr; … … 561 577 #endif 562 578 printf("Result: %#zx\n", f()); 579 } 580 581 return 1; 582 } 583 584 /** Call function with zero parameters on each CPU */ 585 int cmd_mcall0(cmd_arg_t *argv) 586 { 587 /* 588 * For each CPU, create a thread which will 589 * call the function. 590 */ 591 592 count_t i; 593 for (i = 0; i < config.cpu_count; i++) { 594 thread_t *t; 595 if ((t = thread_create((void (*)(void *)) cmd_call0, (void *) argv, TASK, THREAD_FLAG_WIRED, "call0", false))) { 596 spinlock_lock(&t->lock); 597 t->cpu = &cpus[i]; 598 spinlock_unlock(&t->lock); 599 printf("cpu%u: ", i); 600 thread_ready(t); 601 thread_join(t); 602 } else 603 printf("Unable to create thread for cpu%u\n", i); 563 604 } 564 605
Note:
See TracChangeset
for help on using the changeset viewer.