Rev 1066 | Rev 1112 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1066 | Rev 1078 | ||
|---|---|---|---|
| Line 35... | Line 35... | ||
| 35 | 35 | ||
| 36 | #include <userspace.h> |
36 | #include <userspace.h> |
| 37 | #include <arch/console.h> |
37 | #include <arch/console.h> |
| 38 | #include <memstr.h> |
38 | #include <memstr.h> |
| 39 | #include <proc/thread.h> |
39 | #include <proc/thread.h> |
| - | 40 | #include <proc/uarg.h> |
|
| 40 | #include <print.h> |
41 | #include <print.h> |
| 41 | 42 | ||
| 42 | #include <arch/interrupt.h> |
43 | #include <arch/interrupt.h> |
| 43 | #include <arch/drivers/arc.h> |
44 | #include <arch/drivers/arc.h> |
| 44 | #include <console/chardev.h> |
45 | #include <console/chardev.h> |
| Line 118... | Line 119... | ||
| 118 | /* Why the linker moves the variable 64K away in assembler |
119 | /* Why the linker moves the variable 64K away in assembler |
| 119 | * when not in .text section ???????? |
120 | * when not in .text section ???????? |
| 120 | */ |
121 | */ |
| 121 | __address supervisor_sp __attribute__ ((section (".text"))); |
122 | __address supervisor_sp __attribute__ ((section (".text"))); |
| 122 | 123 | ||
| 123 | void userspace(uspace_arg_t *uarg) |
124 | void userspace(uspace_arg_t *kernel_uarg) |
| 124 | { |
125 | { |
| 125 | /* EXL=1, UM=1, IE=1 */ |
126 | /* EXL=1, UM=1, IE=1 */ |
| 126 | cp0_status_write(cp0_status_read() | (cp0_status_exl_exception_bit | |
127 | cp0_status_write(cp0_status_read() | (cp0_status_exl_exception_bit | |
| 127 | cp0_status_um_bit | |
128 | cp0_status_um_bit | |
| 128 | cp0_status_ie_enabled_bit)); |
129 | cp0_status_ie_enabled_bit)); |
| 129 | cp0_epc_write(uarg->uspace_entry); |
130 | cp0_epc_write((__address) kernel_uarg->uspace_entry); |
| 130 | userspace_asm(uarg->uspace_stack+PAGE_SIZE); |
131 | userspace_asm(((__address) kernel_uarg->uspace_stack+PAGE_SIZE), (__address) kernel_uarg->uspace_uarg); |
| 131 | while (1) |
132 | while (1) |
| 132 | ; |
133 | ; |
| 133 | } |
134 | } |
| 134 | 135 | ||
| 135 | void before_thread_runs_arch(void) |
136 | void before_thread_runs_arch(void) |