Changes in kernel/generic/src/console/cmd.c [c992538a:4ce914d4] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/cmd.c
rc992538a r4ce914d4 510 510 void cmd_initialize(cmd_info_t *cmd) 511 511 { 512 spinlock_initialize(&cmd->lock, "cmd .lock");512 spinlock_initialize(&cmd->lock, "cmd"); 513 513 link_initialize(&cmd->link); 514 514 } … … 658 658 printf("Duplicate symbol, be more specific.\n"); 659 659 } else if (rc == EOK) { 660 ipl_t ipl;661 662 ipl = interrupts_disable();663 660 fnc = (unative_t (*)(void)) arch_construct_function(&fptr, 664 661 (void *) symaddr, (void *) cmd_call0); 665 662 printf("Calling %s() (%p)\n", symbol, symaddr); 666 663 printf("Result: %#" PRIxn "\n", fnc()); 667 interrupts_restore(ipl);668 664 } else { 669 665 printf("No symbol information available.\n"); … … 685 681 continue; 686 682 687 thread_t *thread; 688 if ((thread = thread_create((void (*)(void *)) cmd_call0, 689 (void *) argv, TASK, THREAD_FLAG_WIRED, "call0", false))) { 690 irq_spinlock_lock(&thread->lock, true); 691 thread->cpu = &cpus[i]; 692 irq_spinlock_unlock(&thread->lock, true); 693 694 printf("cpu%" PRIs ": ", i); 695 696 thread_ready(thread); 697 thread_join(thread); 698 thread_detach(thread); 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); 699 692 } else 700 printf("Unable to create thread for cpu% " PRIs "\n", i);693 printf("Unable to create thread for cpu%u\n", i); 701 694 } 702 695 … … 723 716 printf("Duplicate symbol, be more specific.\n"); 724 717 } else if (rc == EOK) { 725 ipl_t ipl;726 727 ipl = interrupts_disable();728 718 fnc = (unative_t (*)(unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call1); 729 719 printf("Calling f(%#" PRIxn "): %p: %s\n", arg1, symaddr, symbol); 730 720 printf("Result: %#" PRIxn "\n", fnc(arg1)); 731 interrupts_restore(ipl);732 721 } else { 733 722 printf("No symbol information available.\n"); … … 757 746 printf("Duplicate symbol, be more specific.\n"); 758 747 } else if (rc == EOK) { 759 ipl_t ipl;760 761 ipl = interrupts_disable();762 748 fnc = (unative_t (*)(unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call2); 763 749 printf("Calling f(%#" PRIxn ", %#" PRIxn "): %p: %s\n", 764 750 arg1, arg2, symaddr, symbol); 765 751 printf("Result: %#" PRIxn "\n", fnc(arg1, arg2)); 766 interrupts_restore(ipl);767 752 } else { 768 753 printf("No symbol information available.\n"); … … 792 777 printf("Duplicate symbol, be more specific.\n"); 793 778 } else if (rc == EOK) { 794 ipl_t ipl;795 796 ipl = interrupts_disable();797 779 fnc = (unative_t (*)(unative_t, unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call3); 798 780 printf("Calling f(%#" PRIxn ",%#" PRIxn ", %#" PRIxn "): %p: %s\n", 799 781 arg1, arg2, arg3, symaddr, symbol); 800 782 printf("Result: %#" PRIxn "\n", fnc(arg1, arg2, arg3)); 801 interrupts_restore(ipl);802 783 } else { 803 784 printf("No symbol information available.\n"); … … 1068 1049 /* Update and read thread accounting 1069 1050 for benchmarking */ 1070 irq_spinlock_lock(&TASK->lock, true); 1051 ipl_t ipl = interrupts_disable(); 1052 spinlock_lock(&TASK->lock); 1071 1053 uint64_t ucycles0, kcycles0; 1072 1054 task_get_accounting(TASK, &ucycles0, &kcycles0); 1073 irq_spinlock_unlock(&TASK->lock, true); 1055 spinlock_unlock(&TASK->lock); 1056 interrupts_restore(ipl); 1074 1057 1075 1058 /* Execute the test */ … … 1078 1061 1079 1062 /* Update and read thread accounting */ 1080 uint64_t ucycles1, kcycles1; 1081 irq_spinlock_lock(&TASK->lock, true); 1063 uint64_t ucycles1, kcycles1; 1064 ipl = interrupts_disable(); 1065 spinlock_lock(&TASK->lock); 1082 1066 task_get_accounting(TASK, &ucycles1, &kcycles1); 1083 irq_spinlock_unlock(&TASK->lock, true); 1067 spinlock_unlock(&TASK->lock); 1068 interrupts_restore(ipl); 1084 1069 1085 1070 uint64_t ucycles, kcycles; … … 1087 1072 order_suffix(ucycles1 - ucycles0, &ucycles, &usuffix); 1088 1073 order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix); 1089 1074 1090 1075 printf("Time: %" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles\n", 1091 1076 ucycles, usuffix, kcycles, ksuffix); 1092 1077 1093 1078 if (ret == NULL) { … … 1095 1080 return true; 1096 1081 } 1097 1082 1098 1083 printf("%s\n", ret); 1099 1084 return false; … … 1121 1106 /* Update and read thread accounting 1122 1107 for benchmarking */ 1123 irq_spinlock_lock(&TASK->lock, true); 1108 ipl_t ipl = interrupts_disable(); 1109 spinlock_lock(&TASK->lock); 1124 1110 uint64_t ucycles0, kcycles0; 1125 1111 task_get_accounting(TASK, &ucycles0, &kcycles0); 1126 irq_spinlock_unlock(&TASK->lock, true); 1112 spinlock_unlock(&TASK->lock); 1113 interrupts_restore(ipl); 1127 1114 1128 1115 /* Execute the test */ … … 1131 1118 1132 1119 /* Update and read thread accounting */ 1133 irq_spinlock_lock(&TASK->lock, true); 1120 ipl = interrupts_disable(); 1121 spinlock_lock(&TASK->lock); 1134 1122 uint64_t ucycles1, kcycles1; 1135 1123 task_get_accounting(TASK, &ucycles1, &kcycles1); 1136 irq_spinlock_unlock(&TASK->lock, true); 1137 1124 spinlock_unlock(&TASK->lock); 1125 interrupts_restore(ipl); 1126 1138 1127 if (ret != NULL) { 1139 1128 printf("%s\n", ret); … … 1146 1135 order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix); 1147 1136 printf("OK (%" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles)\n", 1148 1137 ucycles, usuffix, kcycles, ksuffix); 1149 1138 } 1150 1139
Note:
See TracChangeset
for help on using the changeset viewer.