/kernel/trunk/generic/src/main/kinit.c |
---|
26,10 → 26,11 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <main/kinit.h> |
#include <main/kconsole.h> |
#include <main/uinit.h> |
#include <config.h> |
#include <arch.h> |
#include <main/kinit.h> |
#include <main/uinit.h> |
#include <proc/scheduler.h> |
#include <proc/task.h> |
#include <proc/thread.h> |
82,7 → 83,7 |
thread_ready(t); |
waitq_sleep(&kmp_completion_wq); |
} |
else panic("thread_create/kmp"); |
else panic("thread_create/kmp\n"); |
} |
#endif /* CONFIG_SMP */ |
/* |
109,12 → 110,19 |
spinlock_unlock(&t->lock); |
thread_ready(t); |
} |
else panic("thread_create/kcpulb"); |
else panic("thread_create/kcpulb\n"); |
} |
} |
#endif /* CONFIG_SMP */ |
/* |
* Create kernel console. |
*/ |
if (t = thread_create(kconsole, NULL, TASK, 0)) |
thread_ready(t); |
else panic("thread_create/kconsole\n"); |
interrupts_enable(); |
#ifdef CONFIG_USERSPACE |
123,13 → 131,13 |
*/ |
m = vm_create(NULL); |
if (!m) |
panic("vm_create"); |
panic("vm_create\n"); |
u = task_create(m); |
if (!u) |
panic("task_create"); |
panic("task_create\n"); |
t = thread_create(uinit, NULL, u, THREAD_USER_STACK); |
if (!t) |
panic("thread_create"); |
panic("thread_create\n"); |
/* |
* Create the text vm_area and copy the userspace code there. |
136,7 → 144,7 |
*/ |
a = vm_area_create(m, VMA_TEXT, 1, UTEXT_ADDRESS); |
if (!a) |
panic("vm_area_create: vm_text"); |
panic("vm_area_create: vm_text\n"); |
vm_area_map(a, m); |
memcpy((void *) PA2KA(a->mapping[0]), (void *) utext, utext_size < PAGE_SIZE ? utext_size : PAGE_SIZE); |
145,7 → 153,7 |
*/ |
a = vm_area_create(m, VMA_STACK, 1, USTACK_ADDRESS); |
if (!a) |
panic("vm_area_create: vm_stack"); |
panic("vm_area_create: vm_stack\n"); |
vm_area_map(a, m); |
thread_ready(t); |
155,7 → 163,6 |
test(); |
#endif /* CONFIG_TEST */ |
while (1) { |
thread_sleep(60); |
printf("kinit... "); |
/kernel/trunk/generic/src/main/main.c |
---|
70,7 → 70,7 |
char *rr_delimiter = ""; |
char *revision = ""; |
#endif |
char *copyright = "Copyright (C) 2001-2005 Jakub Jermar\nCopyright (C) 2005 HelenOS project"; |
char *copyright = "Copyright (C) 2001-2005 HelenOS project"; |
config_t config; |
context_t ctx; |
/kernel/trunk/generic/src/main/kconsole.c |
---|
0,0 → 1,53 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* 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 <main/kconsole.h> |
#include <console/console.h> |
#include <console/chardev.h> |
#include <print.h> |
#include <typedefs.h> |
#include <arch/types.h> |
/** Kernel console managing thread. |
* |
* @param arg Not used. |
*/ |
void kconsole(void *arg) |
{ |
__u8 buf[CHARDEV_BUFLEN]; |
if (!stdin) { |
printf("%s: no stdin\n", __FUNCTION__); |
return; |
} |
while (true) { |
printf("%s> ", __FUNCTION__); |
gets(stdin, buf, sizeof(buf)); |
} |
} |