Ignore:
File:
1 edited

Legend:

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

    rc992538a r4ce914d4  
    510510void cmd_initialize(cmd_info_t *cmd)
    511511{
    512         spinlock_initialize(&cmd->lock, "cmd.lock");
     512        spinlock_initialize(&cmd->lock, "cmd");
    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();
    663660                fnc = (unative_t (*)(void)) arch_construct_function(&fptr,
    664661                    (void *) symaddr, (void *) cmd_call0);
    665662                printf("Calling %s() (%p)\n", symbol, symaddr);
    666663                printf("Result: %#" PRIxn "\n", fnc());
    667                 interrupts_restore(ipl);
    668664        } else {
    669665                printf("No symbol information available.\n");
     
    685681                        continue;
    686682               
    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);
    699692                } else
    700                         printf("Unable to create thread for cpu%" PRIs "\n", i);
     693                        printf("Unable to create thread for cpu%u\n", i);
    701694        }
    702695       
     
    723716                printf("Duplicate symbol, be more specific.\n");
    724717        } else if (rc == EOK) {
    725                 ipl_t ipl;
    726 
    727                 ipl = interrupts_disable();
    728718                fnc = (unative_t (*)(unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call1);
    729719                printf("Calling f(%#" PRIxn "): %p: %s\n", arg1, symaddr, symbol);
    730720                printf("Result: %#" PRIxn "\n", fnc(arg1));
    731                 interrupts_restore(ipl);
    732721        } else {
    733722                printf("No symbol information available.\n");
     
    757746                printf("Duplicate symbol, be more specific.\n");
    758747        } else if (rc == EOK) {
    759                 ipl_t ipl;
    760 
    761                 ipl = interrupts_disable();
    762748                fnc = (unative_t (*)(unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call2);
    763749                printf("Calling f(%#" PRIxn ", %#" PRIxn "): %p: %s\n",
    764750                       arg1, arg2, symaddr, symbol);
    765751                printf("Result: %#" PRIxn "\n", fnc(arg1, arg2));
    766                 interrupts_restore(ipl);
    767752        } else {
    768753                printf("No symbol information available.\n");
     
    792777                printf("Duplicate symbol, be more specific.\n");
    793778        } else if (rc == EOK) {
    794                 ipl_t ipl;
    795 
    796                 ipl = interrupts_disable();
    797779                fnc = (unative_t (*)(unative_t, unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call3);
    798780                printf("Calling f(%#" PRIxn ",%#" PRIxn ", %#" PRIxn "): %p: %s\n",
    799781                       arg1, arg2, arg3, symaddr, symbol);
    800782                printf("Result: %#" PRIxn "\n", fnc(arg1, arg2, arg3));
    801                 interrupts_restore(ipl);
    802783        } else {
    803784                printf("No symbol information available.\n");
     
    10681049        /* Update and read thread accounting
    10691050           for benchmarking */
    1070         irq_spinlock_lock(&TASK->lock, true);
     1051        ipl_t ipl = interrupts_disable();
     1052        spinlock_lock(&TASK->lock);
    10711053        uint64_t ucycles0, kcycles0;
    10721054        task_get_accounting(TASK, &ucycles0, &kcycles0);
    1073         irq_spinlock_unlock(&TASK->lock, true);
     1055        spinlock_unlock(&TASK->lock);
     1056        interrupts_restore(ipl);
    10741057       
    10751058        /* Execute the test */
     
    10781061       
    10791062        /* 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);
    10821066        task_get_accounting(TASK, &ucycles1, &kcycles1);
    1083         irq_spinlock_unlock(&TASK->lock, true);
     1067        spinlock_unlock(&TASK->lock);
     1068        interrupts_restore(ipl);
    10841069       
    10851070        uint64_t ucycles, kcycles;
     
    10871072        order_suffix(ucycles1 - ucycles0, &ucycles, &usuffix);
    10881073        order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix);
    1089        
     1074               
    10901075        printf("Time: %" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles\n",
    1091             ucycles, usuffix, kcycles, ksuffix);
     1076                        ucycles, usuffix, kcycles, ksuffix);
    10921077       
    10931078        if (ret == NULL) {
     
    10951080                return true;
    10961081        }
    1097        
     1082
    10981083        printf("%s\n", ret);
    10991084        return false;
     
    11211106                /* Update and read thread accounting
    11221107                   for benchmarking */
    1123                 irq_spinlock_lock(&TASK->lock, true);
     1108                ipl_t ipl = interrupts_disable();
     1109                spinlock_lock(&TASK->lock);
    11241110                uint64_t ucycles0, kcycles0;
    11251111                task_get_accounting(TASK, &ucycles0, &kcycles0);
    1126                 irq_spinlock_unlock(&TASK->lock, true);
     1112                spinlock_unlock(&TASK->lock);
     1113                interrupts_restore(ipl);
    11271114               
    11281115                /* Execute the test */
     
    11311118               
    11321119                /* Update and read thread accounting */
    1133                 irq_spinlock_lock(&TASK->lock, true);
     1120                ipl = interrupts_disable();
     1121                spinlock_lock(&TASK->lock);
    11341122                uint64_t ucycles1, kcycles1;
    11351123                task_get_accounting(TASK, &ucycles1, &kcycles1);
    1136                 irq_spinlock_unlock(&TASK->lock, true);
    1137                
     1124                spinlock_unlock(&TASK->lock);
     1125                interrupts_restore(ipl);
     1126
    11381127                if (ret != NULL) {
    11391128                        printf("%s\n", ret);
     
    11461135                order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix);
    11471136                printf("OK (%" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles)\n",
    1148                     ucycles, usuffix, kcycles, ksuffix);
     1137                                ucycles, usuffix, kcycles, ksuffix);
    11491138        }
    11501139       
Note: See TracChangeset for help on using the changeset viewer.