Changeset da1bafb in mainline for kernel/generic/src/console/cmd.c
- Timestamp:
- 2010-05-24T18:57:31Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0095368
- Parents:
- 666f492
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/cmd.c
r666f492 rda1bafb 510 510 void cmd_initialize(cmd_info_t *cmd) 511 511 { 512 spinlock_initialize(&cmd->lock, "cmd ");512 spinlock_initialize(&cmd->lock, "cmd.lock"); 513 513 link_initialize(&cmd->link); 514 514 } … … 681 681 continue; 682 682 683 thread_t *t; 684 if ((t = thread_create((void (*)(void *)) cmd_call0, (void *) argv, TASK, THREAD_FLAG_WIRED, "call0", false))) { 685 spinlock_lock(&t->lock); 686 t->cpu = &cpus[i]; 687 spinlock_unlock(&t->lock); 688 printf("cpu%u: ", i); 689 thread_ready(t); 690 thread_join(t); 691 thread_detach(t); 683 thread_t *thread; 684 if ((thread = thread_create((void (*)(void *)) cmd_call0, 685 (void *) argv, TASK, THREAD_FLAG_WIRED, "call0", false))) { 686 irq_spinlock_lock(&thread->lock, true); 687 thread->cpu = &cpus[i]; 688 irq_spinlock_unlock(&thread->lock, true); 689 690 printf("cpu%" PRIs ": ", i); 691 692 thread_ready(thread); 693 thread_join(thread); 694 thread_detach(thread); 692 695 } else 693 printf("Unable to create thread for cpu% u\n", i);696 printf("Unable to create thread for cpu%" PRIs "\n", i); 694 697 } 695 698 … … 1049 1052 /* Update and read thread accounting 1050 1053 for benchmarking */ 1051 ipl_t ipl = interrupts_disable(); 1052 spinlock_lock(&TASK->lock); 1054 irq_spinlock_lock(&TASK->lock, true); 1053 1055 uint64_t ucycles0, kcycles0; 1054 1056 task_get_accounting(TASK, &ucycles0, &kcycles0); 1055 spinlock_unlock(&TASK->lock); 1056 interrupts_restore(ipl); 1057 irq_spinlock_unlock(&TASK->lock, true); 1057 1058 1058 1059 /* Execute the test */ … … 1061 1062 1062 1063 /* Update and read thread accounting */ 1063 uint64_t ucycles1, kcycles1; 1064 ipl = interrupts_disable(); 1065 spinlock_lock(&TASK->lock); 1064 uint64_t ucycles1, kcycles1; 1065 irq_spinlock_lock(&TASK->lock, true); 1066 1066 task_get_accounting(TASK, &ucycles1, &kcycles1); 1067 spinlock_unlock(&TASK->lock); 1068 interrupts_restore(ipl); 1067 irq_spinlock_unlock(&TASK->lock, true); 1069 1068 1070 1069 uint64_t ucycles, kcycles; … … 1072 1071 order_suffix(ucycles1 - ucycles0, &ucycles, &usuffix); 1073 1072 order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix); 1074 1073 1075 1074 printf("Time: %" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles\n", 1076 1075 ucycles, usuffix, kcycles, ksuffix); 1077 1076 1078 1077 if (ret == NULL) { … … 1080 1079 return true; 1081 1080 } 1082 1081 1083 1082 printf("%s\n", ret); 1084 1083 return false; … … 1106 1105 /* Update and read thread accounting 1107 1106 for benchmarking */ 1108 ipl_t ipl = interrupts_disable(); 1109 spinlock_lock(&TASK->lock); 1107 irq_spinlock_lock(&TASK->lock, true); 1110 1108 uint64_t ucycles0, kcycles0; 1111 1109 task_get_accounting(TASK, &ucycles0, &kcycles0); 1112 spinlock_unlock(&TASK->lock); 1113 interrupts_restore(ipl); 1110 irq_spinlock_unlock(&TASK->lock, true); 1114 1111 1115 1112 /* Execute the test */ … … 1118 1115 1119 1116 /* Update and read thread accounting */ 1120 ipl = interrupts_disable(); 1121 spinlock_lock(&TASK->lock); 1117 irq_spinlock_lock(&TASK->lock, true); 1122 1118 uint64_t ucycles1, kcycles1; 1123 1119 task_get_accounting(TASK, &ucycles1, &kcycles1); 1124 spinlock_unlock(&TASK->lock); 1125 interrupts_restore(ipl); 1126 1120 irq_spinlock_unlock(&TASK->lock, true); 1121 1127 1122 if (ret != NULL) { 1128 1123 printf("%s\n", ret); … … 1135 1130 order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix); 1136 1131 printf("OK (%" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles)\n", 1137 1132 ucycles, usuffix, kcycles, ksuffix); 1138 1133 } 1139 1134
Note:
See TracChangeset
for help on using the changeset viewer.