Rev 1860 | Rev 1875 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1860 | Rev 1864 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | #include <arch/stack.h> |
46 | #include <arch/stack.h> |
47 | #include <userspace.h> |
47 | #include <userspace.h> |
48 | 48 | ||
49 | bootinfo_t bootinfo; |
49 | bootinfo_t bootinfo; |
50 | 50 | ||
- | 51 | void arch_pre_main(void) |
|
- | 52 | { |
|
- | 53 | /* Setup usermode */ |
|
- | 54 | init.cnt = bootinfo.taskmap.count; |
|
- | 55 | ||
- | 56 | uint32_t i; |
|
- | 57 | ||
- | 58 | for (i = 0; i < bootinfo.taskmap.count; i++) { |
|
- | 59 | init.tasks[i].addr = PA2KA(bootinfo.taskmap.tasks[i].addr); |
|
- | 60 | init.tasks[i].size = bootinfo.taskmap.tasks[i].size; |
|
- | 61 | } |
|
- | 62 | } |
|
- | 63 | ||
51 | void arch_pre_mm_init(void) |
64 | void arch_pre_mm_init(void) |
52 | { |
65 | { |
53 | trap_init(); |
66 | trap_init(); |
54 | tick_init(); |
67 | tick_init(); |
55 | } |
68 | } |
Line 96... | Line 109... | ||
96 | /** Switch to userspace. */ |
109 | /** Switch to userspace. */ |
97 | void userspace(uspace_arg_t *kernel_uarg) |
110 | void userspace(uspace_arg_t *kernel_uarg) |
98 | { |
111 | { |
99 | switch_to_userspace((uintptr_t) kernel_uarg->uspace_entry, |
112 | switch_to_userspace((uintptr_t) kernel_uarg->uspace_entry, |
100 | ((uintptr_t) kernel_uarg->uspace_stack) + STACK_SIZE |
113 | ((uintptr_t) kernel_uarg->uspace_stack) + STACK_SIZE |
101 | - (ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT) + STACK_BIAS)); |
114 | - (ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT) + STACK_BIAS), |
- | 115 | (uintptr_t) kernel_uarg->uspace_uarg); |
|
102 | 116 | ||
103 | for (;;) |
117 | for (;;) |
104 | ; |
118 | ; |
105 | /* not reached */ |
119 | /* not reached */ |
106 | } |
120 | } |