Changeset 2312685 in mainline


Ignore:
Timestamp:
2005-12-10T18:02:51Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3887b105
Parents:
7a8c866a
Message:

Fixes in new console.

Location:
generic/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • generic/src/console/kconsole.c

    r7a8c866a r2312685  
    119119static char carg1_buf[MAX_CMDLINE+1];
    120120static char carg2_buf[MAX_CMDLINE+1];
     121static char carg3_buf[MAX_CMDLINE+1];
    121122
    122123static int cmd_call0(cmd_arg_t *argv);
     
    181182};
    182183
     184static int cmd_call3(cmd_arg_t *argv);
     185static cmd_arg_t call3_argv[] = {
     186        {
     187                .type = ARG_TYPE_STRING,
     188                .buffer = call0_buf,
     189                .len = sizeof(call0_buf)
     190        },
     191        {
     192                .type = ARG_TYPE_VAR,
     193                .buffer = carg1_buf,
     194                .len = sizeof(carg1_buf)
     195        },
     196        {
     197                .type = ARG_TYPE_VAR,
     198                .buffer = carg2_buf,
     199                .len = sizeof(carg2_buf)
     200        },
     201        {
     202                .type = ARG_TYPE_VAR,
     203                .buffer = carg3_buf,
     204                .len = sizeof(carg3_buf)
     205        }
     206
     207};
     208static cmd_info_t call3_info = {
     209        .name = "call3",
     210        .description = "call3 <function> <arg1> <arg2> <arg3> -> call function(arg1,arg2,arg3).",
     211        .func = cmd_call3,
     212        .argc = 4,
     213        .argv = call3_argv
     214};
    183215
    184216/** Data and methods for 'halt' command. */
     
    228260        if (!cmd_register(&call2_info))
    229261                panic("could not register command %s\n", call2_info.name);
     262
     263        spinlock_initialize(&call3_info.lock, "kconsole_call3");
     264        link_initialize(&call3_info.link);
     265        if (!cmd_register(&call3_info))
     266                panic("could not register command %s\n", call3_info.name);
    230267       
    231268        spinlock_initialize(&halt_info.lock, "kconsole_halt");
     
    653690}
    654691
     692/** Call function with three parameters */
     693int cmd_call3(cmd_arg_t *argv)
     694{
     695        __address symaddr;
     696        char *symbol;
     697        __native (*f)(__native,__native,__native);
     698        __native arg1 = argv[1].intval;
     699        __native arg2 = argv[2].intval;
     700        __native arg3 = argv[3].intval;
     701
     702        symaddr = get_symbol_addr(argv->buffer);
     703        if (!symaddr)
     704                printf("Symbol %s not found.\n", argv->buffer);
     705        else if (symaddr == (__address) -1) {
     706                symtab_print_search(argv->buffer);
     707                printf("Duplicate symbol, be more specific.\n");
     708        } else {
     709                symbol = get_symtab_entry(symaddr);
     710                printf("Calling f(0x%x,0x%x, 0x%x): 0x%p: %s\n",
     711                       arg1, arg2, arg3, symaddr, symbol);
     712                f =  (__native (*)(__native,__native,__native)) symaddr;
     713                printf("Result: 0x%x\n", f(arg1, arg2, arg3));
     714        }
     715       
     716        return 1;
     717}
     718
    655719
    656720/** Print detailed description of 'describe' command. */
  • generic/src/lib/func.c

    r7a8c866a r2312685  
    136136
    137137        while (*text) {
    138                 result *= base;
    139138                if (base != 16 && *text >= 'A' && *text <= 'F')
    140139                        break;
     
    142141                        break;
    143142
    144                 if (*text >= '0' && *text <= '9')
     143                if (*text >= '0' && *text <= '9') {
     144                        result *= base;
    145145                        result += *text - '0';
    146                 else if (*text >= 'A' && *text <= 'F')
     146                } else if (*text >= 'A' && *text <= 'F') {
     147                        result *= base;
    147148                        result += *text - 'A' + 10;
    148                 else
     149                } else
    149150                        break;
    150151                text++;
  • generic/src/mm/heap.c

    r7a8c866a r2312685  
    6565        chunk_t *x, *y, *z;
    6666
    67         size = ALIGN_UP(size, sizeof(__native));
    68 
    6967        if (size == 0)
    7068                panic("zero-size allocation request");
    7169               
     70        size = ALIGN_UP(size, sizeof(__native));
     71
    7272        x = chunk0;
    7373        ipl = interrupts_disable();
Note: See TracChangeset for help on using the changeset viewer.