Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 608 → Rev 609

/kernel/trunk/test/debug/mips1/test.c
0,0 → 1,50
/*
* Copyright (C) 2005 Ondrej Palkovsky
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#include <print.h>
#include <debug.h>
#include <panic.h>
 
#include <test.h>
#include <arch/atomic.h>
#include <proc/thread.h>
#include <time/delay.h>
 
#include <arch.h>
 
 
void test(void)
{
printf("MIPS debug test #1\n");
 
printf("You should enter kconsole debug mode now.\n");
 
asm __volatile__ ("break");
 
printf("Test passed.\n");
}
/kernel/trunk/kernel.config
81,4 → 81,5
@ "print/print1" Printf test 1
@ "thread/thread1" Thread test 1
@ "mm/mapping1" Mapping test 1
@ [ARCH=mips32] "debug/mips1" Mips breakpoint-debug test
! CONFIG_TEST (choice)
/kernel/trunk/generic/include/console/kconsole.h
68,7 → 68,7
extern link_t cmd_head;
 
extern void kconsole_init(void);
extern void kconsole(void *arg);
extern void kconsole(void *prompt);
 
extern int cmd_register(cmd_info_t *cmd);
 
/kernel/trunk/generic/src/console/cmd.c
58,6 → 58,12
.argc = 0
};
 
static cmd_info_t exit_info = {
.name = "exit",
.description ="Exit kconsole",
.argc = 0
};
 
/** Data and methods for 'description' command. */
static int cmd_desc(cmd_arg_t *argv);
static void desc_help(void);
256,6 → 262,10
cmd_initialize(&desc_info);
if (!cmd_register(&desc_info))
panic("could not register command %s\n", desc_info.name);
 
cmd_initialize(&exit_info);
if (!cmd_register(&exit_info))
panic("could not register command %s\n", exit_info.name);
cmd_initialize(&symaddr_info);
if (!cmd_register(&symaddr_info))
/kernel/trunk/generic/src/console/kconsole.c
40,6 → 40,7
#include <debug.h>
#include <func.h>
#include <symtab.h>
#include <macros.h>
 
/** Simple kernel console.
*
395,7 → 396,7
*
* @param arg Not used.
*/
void kconsole(void *arg)
void kconsole(void *prompt)
{
cmd_info_t *cmd_info;
count_t len;
407,7 → 408,7
}
while (true) {
cmdline = clever_readline(__FUNCTION__, stdin);
cmdline = clever_readline(prompt, stdin);
len = strlen(cmdline);
if (!len)
continue;
414,6 → 415,9
cmd_info = parse_cmdline(cmdline, len);
if (!cmd_info)
continue;
if (strncmp(cmd_info->name,"exit", \
min(strlen(cmd_info->name),5)) == 0)
break;
(void) cmd_info->func(cmd_info->argv);
}
}
/kernel/trunk/generic/src/main/kinit.c
133,7 → 133,7
/*
* Create kernel console.
*/
if (t = thread_create(kconsole, NULL, TASK, 0))
if (t = thread_create(kconsole, "kconsole", TASK, 0))
thread_ready(t);
else panic("thread_create/kconsole\n");
 
/kernel/trunk/generic/src/lib/func.c
48,7 → 48,7
interrupts_disable();
#ifdef CONFIG_DEBUG
printf("\n");
kconsole(NULL); /* Run kconsole as a last resort to user */
kconsole("panic"); /* Run kconsole as a last resort to user */
#endif
 
if (CPU)
/kernel/trunk/arch/mips32/src/exception.c
37,6 → 37,8
#include <symtab.h>
#include <print.h>
#include <interrupt.h>
#include <func.h>
#include <console/kconsole.h>
 
static char * exctable[] = {
"Interrupt","TLB Modified","TLB Invalid","TLB Invalid Store",
85,6 → 87,17
static void breakpoint_exception(int n, void *data)
{
struct exception_regdump *pstate = (struct exception_regdump *)data;
char *symbol = get_symtab_entry(pstate->epc);
 
#ifdef CONFIG_DEBUG
printf("***Breakpoint %p in %s.\n", pstate->epc, symbol);
printf("***Type 'exit' to exit kconsole.\n");
/* Umm..we should rather set some 'debugstate' here */
haltstate = 1;
kconsole("debug");
haltstate = 0;
#endif
 
/* it is necessary to not re-execute BREAK instruction after
returning from Exception handler
(see page 138 in R4000 Manual for more information) */