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