Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/cmd.c

    r4ce914d4 rc992538a  
    510510void cmd_initialize(cmd_info_t *cmd)
    511511{
    512         spinlock_initialize(&cmd->lock, "cmd");
     512        spinlock_initialize(&cmd->lock, "cmd.lock");
    513513        link_initialize(&cmd->link);
    514514}
     
    658658                printf("Duplicate symbol, be more specific.\n");
    659659        } else if (rc == EOK) {
     660                ipl_t ipl;
     661
     662                ipl = interrupts_disable();
    660663                fnc = (unative_t (*)(void)) arch_construct_function(&fptr,
    661664                    (void *) symaddr, (void *) cmd_call0);
    662665                printf("Calling %s() (%p)\n", symbol, symaddr);
    663666                printf("Result: %#" PRIxn "\n", fnc());
     667                interrupts_restore(ipl);
    664668        } else {
    665669                printf("No symbol information available.\n");
     
    681685                        continue;
    682686               
    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);
    692699                } else
    693                         printf("Unable to create thread for cpu%u\n", i);
     700                        printf("Unable to create thread for cpu%" PRIs "\n", i);
    694701        }
    695702       
     
    716723                printf("Duplicate symbol, be more specific.\n");
    717724        } else if (rc == EOK) {
     725                ipl_t ipl;
     726
     727                ipl = interrupts_disable();
    718728                fnc = (unative_t (*)(unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call1);
    719729                printf("Calling f(%#" PRIxn "): %p: %s\n", arg1, symaddr, symbol);
    720730                printf("Result: %#" PRIxn "\n", fnc(arg1));
     731                interrupts_restore(ipl);
    721732        } else {
    722733                printf("No symbol information available.\n");
     
    746757                printf("Duplicate symbol, be more specific.\n");
    747758        } else if (rc == EOK) {
     759                ipl_t ipl;
     760
     761                ipl = interrupts_disable();
    748762                fnc = (unative_t (*)(unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call2);
    749763                printf("Calling f(%#" PRIxn ", %#" PRIxn "): %p: %s\n",
    750764                       arg1, arg2, symaddr, symbol);
    751765                printf("Result: %#" PRIxn "\n", fnc(arg1, arg2));
     766                interrupts_restore(ipl);
    752767        } else {
    753768                printf("No symbol information available.\n");
     
    777792                printf("Duplicate symbol, be more specific.\n");
    778793        } else if (rc == EOK) {
     794                ipl_t ipl;
     795
     796                ipl = interrupts_disable();
    779797                fnc = (unative_t (*)(unative_t, unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call3);
    780798                printf("Calling f(%#" PRIxn ",%#" PRIxn ", %#" PRIxn "): %p: %s\n",
    781799                       arg1, arg2, arg3, symaddr, symbol);
    782800                printf("Result: %#" PRIxn "\n", fnc(arg1, arg2, arg3));
     801                interrupts_restore(ipl);
    783802        } else {
    784803                printf("No symbol information available.\n");
     
    10491068        /* Update and read thread accounting
    10501069           for benchmarking */
    1051         ipl_t ipl = interrupts_disable();
    1052         spinlock_lock(&TASK->lock);
     1070        irq_spinlock_lock(&TASK->lock, true);
    10531071        uint64_t ucycles0, kcycles0;
    10541072        task_get_accounting(TASK, &ucycles0, &kcycles0);
    1055         spinlock_unlock(&TASK->lock);
    1056         interrupts_restore(ipl);
     1073        irq_spinlock_unlock(&TASK->lock, true);
    10571074       
    10581075        /* Execute the test */
     
    10611078       
    10621079        /* 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);
    10661082        task_get_accounting(TASK, &ucycles1, &kcycles1);
    1067         spinlock_unlock(&TASK->lock);
    1068         interrupts_restore(ipl);
     1083        irq_spinlock_unlock(&TASK->lock, true);
    10691084       
    10701085        uint64_t ucycles, kcycles;
     
    10721087        order_suffix(ucycles1 - ucycles0, &ucycles, &usuffix);
    10731088        order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix);
    1074                
     1089       
    10751090        printf("Time: %" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles\n",
    1076                         ucycles, usuffix, kcycles, ksuffix);
     1091            ucycles, usuffix, kcycles, ksuffix);
    10771092       
    10781093        if (ret == NULL) {
     
    10801095                return true;
    10811096        }
    1082 
     1097       
    10831098        printf("%s\n", ret);
    10841099        return false;
     
    11061121                /* Update and read thread accounting
    11071122                   for benchmarking */
    1108                 ipl_t ipl = interrupts_disable();
    1109                 spinlock_lock(&TASK->lock);
     1123                irq_spinlock_lock(&TASK->lock, true);
    11101124                uint64_t ucycles0, kcycles0;
    11111125                task_get_accounting(TASK, &ucycles0, &kcycles0);
    1112                 spinlock_unlock(&TASK->lock);
    1113                 interrupts_restore(ipl);
     1126                irq_spinlock_unlock(&TASK->lock, true);
    11141127               
    11151128                /* Execute the test */
     
    11181131               
    11191132                /* Update and read thread accounting */
    1120                 ipl = interrupts_disable();
    1121                 spinlock_lock(&TASK->lock);
     1133                irq_spinlock_lock(&TASK->lock, true);
    11221134                uint64_t ucycles1, kcycles1;
    11231135                task_get_accounting(TASK, &ucycles1, &kcycles1);
    1124                 spinlock_unlock(&TASK->lock);
    1125                 interrupts_restore(ipl);
    1126 
     1136                irq_spinlock_unlock(&TASK->lock, true);
     1137               
    11271138                if (ret != NULL) {
    11281139                        printf("%s\n", ret);
     
    11351146                order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix);
    11361147                printf("OK (%" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles)\n",
    1137                                 ucycles, usuffix, kcycles, ksuffix);
     1148                    ucycles, usuffix, kcycles, ksuffix);
    11381149        }
    11391150       
Note: See TracChangeset for help on using the changeset viewer.