Subversion Repositories HelenOS-historic

Rev

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

Rev 589 Rev 591
Line 116... Line 116...
116
 
116
 
117
/** Call0 - call function with no parameters */
117
/** Call0 - call function with no parameters */
118
static char call0_buf[MAX_CMDLINE+1];
118
static char call0_buf[MAX_CMDLINE+1];
119
static char carg1_buf[MAX_CMDLINE+1];
119
static char carg1_buf[MAX_CMDLINE+1];
120
static char carg2_buf[MAX_CMDLINE+1];
120
static char carg2_buf[MAX_CMDLINE+1];
-
 
121
static char carg3_buf[MAX_CMDLINE+1];
121
 
122
 
122
static int cmd_call0(cmd_arg_t *argv);
123
static int cmd_call0(cmd_arg_t *argv);
123
static cmd_arg_t call0_argv = {
124
static cmd_arg_t call0_argv = {
124
    .type = ARG_TYPE_STRING,
125
    .type = ARG_TYPE_STRING,
125
    .buffer = call0_buf,
126
    .buffer = call0_buf,
Line 178... Line 179...
178
    .func = cmd_call2,
179
    .func = cmd_call2,
179
    .argc = 3,
180
    .argc = 3,
180
    .argv = call2_argv
181
    .argv = call2_argv
181
};
182
};
182
 
183
 
-
 
184
static int cmd_call3(cmd_arg_t *argv);
-
 
185
static 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
};
-
 
208
static 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
};
183
 
215
 
184
/** Data and methods for 'halt' command. */
216
/** Data and methods for 'halt' command. */
185
static int cmd_halt(cmd_arg_t *argv);
217
static int cmd_halt(cmd_arg_t *argv);
186
static cmd_info_t halt_info = {
218
static cmd_info_t halt_info = {
187
    .name = "halt",
219
    .name = "halt",
Line 225... Line 257...
225
 
257
 
226
    spinlock_initialize(&call2_info.lock, "kconsole_call2");
258
    spinlock_initialize(&call2_info.lock, "kconsole_call2");
227
    link_initialize(&call2_info.link);
259
    link_initialize(&call2_info.link);
228
    if (!cmd_register(&call2_info))
260
    if (!cmd_register(&call2_info))
229
        panic("could not register command %s\n", call2_info.name);
261
        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);
230
   
267
   
231
    spinlock_initialize(&halt_info.lock, "kconsole_halt");
268
    spinlock_initialize(&halt_info.lock, "kconsole_halt");
232
    link_initialize(&halt_info.link);
269
    link_initialize(&halt_info.link);
233
    if (!cmd_register(&halt_info))
270
    if (!cmd_register(&halt_info))
234
        panic("could not register command %s\n", halt_info.name);
271
        panic("could not register command %s\n", halt_info.name);
Line 650... Line 687...
650
    }
687
    }
651
   
688
   
652
    return 1;
689
    return 1;
653
}
690
}
654
 
691
 
-
 
692
/** Call function with three parameters */
-
 
693
int 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
 
655
 
719
 
656
/** Print detailed description of 'describe' command. */
720
/** Print detailed description of 'describe' command. */
657
void desc_help(void)
721
void desc_help(void)
658
{
722
{
659
    printf("Syntax: describe command_name\n");
723
    printf("Syntax: describe command_name\n");