Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 716 → Rev 717

/kernel/trunk/kernel.config
63,9 → 63,6
 
## Run-time configuration directives
 
# Enable user space support
! CONFIG_USERSPACE (n/y)
 
# Kernel test type
@ "" No test
@ "synch/rwlock1" Read write test 1
/kernel/trunk/generic/include/main/uinit.h
31,9 → 31,6
 
#include <arch/types.h>
 
extern void utext(void);
extern __u32 utext_size;
 
extern void uinit(void *arg);
 
#endif
/kernel/trunk/generic/src/main/kinit.c
69,13 → 69,11
void kinit(void *arg)
{
thread_t *t;
#ifdef CONFIG_USERSPACE
as_t *as;
as_area_t *a;
__address frame;
index_t pfn[1];
task_t *u;
#endif
 
interrupts_disable();
 
139,46 → 137,43
 
interrupts_enable();
 
#ifdef CONFIG_USERSPACE
/*
* Create the first user task.
*/
as = as_create(NULL);
if (!as)
panic("as_create\n");
u = task_create(as);
if (!u)
panic("task_create\n");
t = thread_create(uinit, NULL, u, THREAD_USER_STACK);
if (!t)
panic("thread_create\n");
 
/*
* Create the text as_area and copy the userspace code there.
*/
a = as_area_create(as, AS_AREA_TEXT, 1, UTEXT_ADDRESS);
if (!a)
panic("as_area_create: text\n");
 
frame = frame_alloc(0, ONE_FRAME, NULL);
 
if (config.init_size > 0)
if (config.init_size > 0) {
/*
* Create the first user task.
*/
as = as_create(NULL);
if (!as)
panic("as_create\n");
u = task_create(as);
if (!u)
panic("task_create\n");
t = thread_create(uinit, NULL, u, THREAD_USER_STACK);
if (!t)
panic("thread_create\n");
/*
* Create the text as_area and copy the userspace code there.
*/
a = as_area_create(as, AS_AREA_TEXT, 1, UTEXT_ADDRESS);
if (!a)
panic("as_area_create: text\n");
// FIXME: Better way to initialize static code/data
frame = frame_alloc(0, ONE_FRAME, NULL);
memcpy((void *) PA2KA(frame), (void *) config.init_addr, config.init_size < PAGE_SIZE ? config.init_size : PAGE_SIZE);
else
memcpy((void *) PA2KA(frame), (void *) utext, utext_size < PAGE_SIZE ? utext_size : PAGE_SIZE);
pfn[0] = frame / FRAME_SIZE;
as_area_load_mapping(a, pfn);
pfn[0] = frame / FRAME_SIZE;
as_area_load_mapping(a, pfn);
 
/*
* Create the data as_area.
*/
a = as_area_create(as, AS_AREA_STACK, 1, USTACK_ADDRESS);
if (!a)
panic("as_area_create: stack\n");
/*
* Create the data as_area.
*/
a = as_area_create(as, AS_AREA_STACK, 1, USTACK_ADDRESS);
if (!a)
panic("as_area_create: stack\n");
thread_ready(t);
#endif /* CONFIG_USERSPACE */
thread_ready(t);
}
 
#ifdef CONFIG_TEST
test();
/kernel/trunk/Makefile
69,9 → 69,6
ifeq ($(CONFIG_DEBUG_SPINLOCK),y)
DEFS += -DCONFIG_DEBUG_SPINLOCK
endif
ifeq ($(CONFIG_USERSPACE),y)
DEFS += -DCONFIG_USERSPACE
endif
ifeq ($(CONFIG_FPU_LAZY),y)
DEFS += -DCONFIG_FPU_LAZY
endif
/kernel/trunk/arch/amd64/src/asm_utils.S
53,22 → 53,6
.global read_efer_flag
.global set_efer_flag
 
# THIS IS USERSPACE CODE
.global utext
utext:
0:
int $48
jmp 0b
# not reached
utext_end:
 
.data
.global utext_size
utext_size:
.long utext_end - utext
 
## Determine CPUID support
#
# Return 0 in EAX if CPUID is not support, 1 if supported.
207,7 → 191,6
handler 0 IDT_ITEMS
h_end:
.data
.global interrupt_handler_size
 
/kernel/trunk/arch/mips32/src/asm.S
295,17 → 295,3
#endif
j $ra
nop
# THIS IS USERSPACE CODE
.global utext
utext:
j $31
nop
utext_end:
 
.data
.global utext_size
utext_size:
.long utext_end-utext
 
/kernel/trunk/arch/ia32/src/asm.S
148,26 → 148,7
# handler 192 256
h_end:
 
 
# THIS IS USERSPACE CODE
.global utext
utext:
xor %ax,%ax
mov %ax,%ds
mov %ax,%es
mov %ax,%fs
mov %ax,%gs
0:
int $48
jmp 0b
# not reached
utext_end:
 
.data
.global utext_size
utext_size:
.long utext_end - utext
 
.global interrupt_handler_size
 
interrupt_handler_size: .long (h_end-h_start)/IDT_ITEMS