From 8be1739f454e88db9bc9932f3267279780d8d4ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 30 May 2006 19:54:37 +0000 Subject: [PATCH] - change the check_pending_repeats from a thread to a kernel_daemon, one less. - add loading of kernel debugger/ modules - add a kgets() exported func for use by nasty modules =) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17657 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/debug/debug.c | 59 ++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/src/system/kernel/debug/debug.c b/src/system/kernel/debug/debug.c index bb78e4c07d..98b98fe7ca 100644 --- a/src/system/kernel/debug/debug.c +++ b/src/system/kernel/debug/debug.c @@ -63,7 +63,7 @@ static char sOutputBuffer[OUTPUT_BUFFER_SIZE]; static char sLastOutputBuffer[OUTPUT_BUFFER_SIZE]; static void flush_pending_repeats(void); -static status_t check_pending_repeats(void *data); +static void check_pending_repeats(void *data, int iter); static int64 sMessageRepeatTime = 0; static int32 sMessageRepeatCount = 0; @@ -257,6 +257,13 @@ read_line(char *buffer, int32 maxLength) } +extern int +kgets(char *buf, int len) +{ + return read_line(buf, len); +} + + static int parse_line(char *buf, char **argv, int *argc, int max_args) { @@ -676,13 +683,29 @@ debug_init_post_vm(kernel_args *args) status_t debug_init_post_modules(struct kernel_args *args) { - thread_id thread = spawn_kernel_thread(check_pending_repeats, - "check repeats", B_LOW_PRIORITY, NULL); - if (thread >= B_OK) - resume_thread(thread); + void *cookie; + + // check for dupped lines every 10/10 second + register_kernel_daemon(check_pending_repeats, NULL, 10); syslog_init_post_threads(); + // load kernel debugger addons + cookie = open_module_list("debugger"); + while (true) { + char name[B_FILE_NAME_LENGTH]; + size_t nameLength = sizeof(name); + module_info *module; + + if (read_next_module_name(cookie, name, &nameLength) != B_OK) + break; + if (get_module(name, &module) == B_OK) + dprintf("kernel debugger extention \"%s\": loaded\n", name); + else + dprintf("kernel debugger extention \"%s\": failed to load\n", name); + } + close_module_list(cookie); + return frame_buffer_console_init_post_modules(args); } @@ -854,25 +877,21 @@ flush_pending_repeats(void) } -static status_t -check_pending_repeats(void *data) +static void +check_pending_repeats(void *data, int iter) { - while (true) { - if (sMessageRepeatCount > 0 - && (system_time() - sMessageRepeatTime) > 1000000) { - cpu_status state = disable_interrupts(); - acquire_spinlock(&sSpinlock); + (void)data; + (void)iter; + if (sMessageRepeatCount > 0 + && (system_time() - sMessageRepeatTime) > 1000000) { + cpu_status state = disable_interrupts(); + acquire_spinlock(&sSpinlock); - flush_pending_repeats(); + flush_pending_repeats(); - release_spinlock(&sSpinlock); - restore_interrupts(state); - } - - snooze(1000000); + release_spinlock(&sSpinlock); + restore_interrupts(state); } - - return B_OK; }