Subversion Repositories HelenOS

Rev

Rev 2216 | Rev 2224 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2216 Rev 2223
Line 190... Line 190...
190
    .argc = 2,
190
    .argc = 2,
191
    .argv = set4_argv
191
    .argv = set4_argv
192
};
192
};
193
 
193
 
194
/* Data and methods for 'call0' command. */
194
/* Data and methods for 'call0' command. */
195
static char call0_buf[MAX_CMDLINE+1];
195
static char call0_buf[MAX_CMDLINE + 1];
196
static char carg1_buf[MAX_CMDLINE+1];
196
static char carg1_buf[MAX_CMDLINE + 1];
197
static char carg2_buf[MAX_CMDLINE+1];
197
static char carg2_buf[MAX_CMDLINE + 1];
198
static char carg3_buf[MAX_CMDLINE+1];
198
static char carg3_buf[MAX_CMDLINE + 1];
199
 
199
 
200
static int cmd_call0(cmd_arg_t *argv);
200
static int cmd_call0(cmd_arg_t *argv);
201
static cmd_arg_t call0_argv = {
201
static cmd_arg_t call0_argv = {
202
    .type = ARG_TYPE_STRING,
202
    .type = ARG_TYPE_STRING,
203
    .buffer = call0_buf,
203
    .buffer = call0_buf,
Line 209... Line 209...
209
    .func = cmd_call0,
209
    .func = cmd_call0,
210
    .argc = 1,
210
    .argc = 1,
211
    .argv = &call0_argv
211
    .argv = &call0_argv
212
};
212
};
213
 
213
 
-
 
214
/* Data and methods for 'mcall0' command. */
-
 
215
static int cmd_mcall0(cmd_arg_t *argv);
-
 
216
static cmd_arg_t mcall0_argv = {
-
 
217
    .type = ARG_TYPE_STRING,
-
 
218
    .buffer = call0_buf,
-
 
219
    .len = sizeof(call0_buf)
-
 
220
};
-
 
221
static cmd_info_t mcall0_info = {
-
 
222
    .name = "mcall0",
-
 
223
    .description = "mcall0 <function> -> call function() on each CPU.",
-
 
224
    .func = cmd_mcall0,
-
 
225
    .argc = 1,
-
 
226
    .argv = &mcall0_argv
-
 
227
};
-
 
228
 
214
/* Data and methods for 'call1' command. */
229
/* Data and methods for 'call1' command. */
215
static int cmd_call1(cmd_arg_t *argv);
230
static int cmd_call1(cmd_arg_t *argv);
216
static cmd_arg_t call1_argv[] = {
231
static cmd_arg_t call1_argv[] = {
217
    {
232
    {
218
        .type = ARG_TYPE_STRING,
233
        .type = ARG_TYPE_STRING,
Line 404... Line 419...
404
    .argv = NULL
419
    .argv = NULL
405
};
420
};
406
 
421
 
407
static cmd_info_t *basic_commands[] = {
422
static cmd_info_t *basic_commands[] = {
408
    &call0_info,
423
    &call0_info,
-
 
424
    &mcall0_info,
409
    &call1_info,
425
    &call1_info,
410
    &call2_info,
426
    &call2_info,
411
    &call3_info,
427
    &call3_info,
412
    &continue_info,
428
    &continue_info,
413
    &cpus_info,
429
    &cpus_info,
Line 538... Line 554...
538
    unative_t (*f)(void);
554
    unative_t (*f)(void);
539
#ifdef ia64
555
#ifdef ia64
540
    struct {
556
    struct {
541
        unative_t f;
557
        unative_t f;
542
        unative_t gp;
558
        unative_t gp;
543
    }fptr;
559
    } fptr;
544
#endif
560
#endif
545
 
561
 
546
    symaddr = get_symbol_addr((char *) argv->buffer);
562
    symaddr = get_symbol_addr((char *) argv->buffer);
547
    if (!symaddr)
563
    if (!symaddr)
548
        printf("Symbol %s not found.\n", argv->buffer);
564
        printf("Symbol %s not found.\n", argv->buffer);
549
    else if (symaddr == (uintptr_t) -1) {
565
    else if (symaddr == (uintptr_t) -1) {
550
        symtab_print_search((char *) argv->buffer);
566
        symtab_print_search((char *) argv->buffer);
551
        printf("Duplicate symbol, be more specific.\n");
567
        printf("Duplicate symbol, be more specific.\n");
552
    } else {
568
    } else {
553
        symbol = get_symtab_entry(symaddr);
569
        symbol = get_symtab_entry(symaddr);
554
        printf("Calling f(): %.*p: %s\n", sizeof(uintptr_t) * 2, symaddr, symbol);
570
        printf("Calling %s() (%.*p)\n", symbol, sizeof(uintptr_t) * 2, symaddr);
555
#ifdef ia64
571
#ifdef ia64
556
        fptr.f = symaddr;
572
        fptr.f = symaddr;
557
        fptr.gp = ((unative_t *)cmd_call2)[1];
573
        fptr.gp = ((unative_t *)cmd_call2)[1];
558
        f =  (unative_t (*)(void)) &fptr;
574
        f =  (unative_t (*)(void)) &fptr;
559
#else
575
#else
Line 563... Line 579...
563
    }
579
    }
564
   
580
   
565
    return 1;
581
    return 1;
566
}
582
}
567
 
583
 
-
 
584
/** Call function with zero parameters on each CPU */
-
 
585
int cmd_mcall0(cmd_arg_t *argv)
-
 
586
{
-
 
587
    /*
-
 
588
     * For each CPU, create a thread which will
-
 
589
     * call the function.
-
 
590
     */
-
 
591
   
-
 
592
    count_t i;
-
 
593
    for (i = 0; i < config.cpu_count; i++) {
-
 
594
        thread_t *t;
-
 
595
        if ((t = thread_create((void (*)(void *)) cmd_call0, (void *) argv, TASK, THREAD_FLAG_WIRED, "call0", false))) {
-
 
596
            spinlock_lock(&t->lock);
-
 
597
            t->cpu = &cpus[i];
-
 
598
            spinlock_unlock(&t->lock);
-
 
599
            printf("cpu%u: ", i);
-
 
600
            thread_ready(t);
-
 
601
            thread_join(t);
-
 
602
        } else
-
 
603
            printf("Unable to create thread for cpu%u\n", i);
-
 
604
    }
-
 
605
   
-
 
606
    return 1;
-
 
607
}
-
 
608
 
568
/** Call function with one parameter */
609
/** Call function with one parameter */
569
int cmd_call1(cmd_arg_t *argv)
610
int cmd_call1(cmd_arg_t *argv)
570
{
611
{
571
    uintptr_t symaddr;
612
    uintptr_t symaddr;
572
    char *symbol;
613
    char *symbol;