Rev 1066 | Rev 1102 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1066 | Rev 1078 | ||
|---|---|---|---|
| Line 28... | Line 28... | ||
| 28 | 28 | ||
| 29 | #include <userspace.h> |
29 | #include <userspace.h> |
| 30 | #include <arch/pm.h> |
30 | #include <arch/pm.h> |
| 31 | #include <arch/types.h> |
31 | #include <arch/types.h> |
| 32 | #include <arch.h> |
32 | #include <arch.h> |
| 33 | #include <proc/thread.h> |
33 | #include <proc/uarg.h> |
| 34 | #include <mm/as.h> |
34 | #include <mm/as.h> |
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | /** Enter userspace |
37 | /** Enter userspace |
| 38 | * |
38 | * |
| 39 | * Change CPU protection level to 3, enter userspace. |
39 | * Change CPU protection level to 3, enter userspace. |
| 40 | * |
40 | * |
| 41 | */ |
41 | */ |
| 42 | void userspace(uspace_arg_t *uarg) |
42 | void userspace(uspace_arg_t *kernel_uarg) |
| 43 | { |
43 | { |
| 44 | ipl_t ipl; |
44 | ipl_t ipl; |
| 45 | 45 | ||
| 46 | ipl = interrupts_disable(); |
46 | ipl = interrupts_disable(); |
| 47 | 47 | ||
| Line 49... | Line 49... | ||
| 49 | "pushq %0\n" |
49 | "pushq %0\n" |
| 50 | "pushq %1\n" |
50 | "pushq %1\n" |
| 51 | "pushq %2\n" |
51 | "pushq %2\n" |
| 52 | "pushq %3\n" |
52 | "pushq %3\n" |
| 53 | "pushq %4\n" |
53 | "pushq %4\n" |
| - | 54 | "movq %5, %%rax\n" |
|
| 54 | "iretq\n" |
55 | "iretq\n" |
| 55 | : : |
56 | : : |
| 56 | "i" (gdtselector(UDATA_DES) | PL_USER), |
57 | "i" (gdtselector(UDATA_DES) | PL_USER), |
| 57 | "r" (uarg->uspace_stack+THREAD_STACK_SIZE), |
58 | "r" (kernel_uarg->uspace_stack+THREAD_STACK_SIZE), |
| 58 | "r" (ipl), |
59 | "r" (ipl), |
| 59 | "i" (gdtselector(UTEXT_DES) | PL_USER), |
60 | "i" (gdtselector(UTEXT_DES) | PL_USER), |
| 60 | "r" (uarg->uspace_entry)); |
61 | "r" (kernel_uarg->uspace_entry), |
| - | 62 | "r" (kernel_uarg->uspace_uarg) |
|
| - | 63 | : "rax" |
|
| - | 64 | ); |
|
| 61 | 65 | ||
| 62 | /* Unreachable */ |
66 | /* Unreachable */ |
| 63 | for(;;); |
67 | for(;;) |
| - | 68 | ; |
|
| 64 | } |
69 | } |