Rev 938 | Rev 1078 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 938 | Rev 1066 | ||
---|---|---|---|
Line 37... | Line 37... | ||
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(__address entry) |
42 | void userspace(uspace_arg_t *uarg) |
43 | { |
43 | { |
44 | ipl_t ipl; |
44 | ipl_t ipl; |
45 | 45 | ||
46 | ipl = interrupts_disable(); |
46 | ipl = interrupts_disable(); |
47 | 47 | ||
48 | __asm__ volatile ("" |
48 | __asm__ volatile ("" |
49 | "movq %0, %%rax;" |
- | |
50 | "movq %1, %%rbx;" |
- | |
51 | "movq %2, %%rcx;" |
- | |
52 | "movq %3, %%rdx;" |
- | |
53 | "movq %4, %%rsi;" |
49 | "pushq %0\n" |
54 | "pushq %%rax;" |
50 | "pushq %1\n" |
55 | "pushq %%rbx;" |
51 | "pushq %2\n" |
56 | "pushq %%rcx;" |
52 | "pushq %3\n" |
57 | "pushq %%rdx;" |
53 | "pushq %4\n" |
58 | "pushq %%rsi;" |
54 | "iretq\n" |
59 | "iretq;" |
55 | : : |
60 | : : "i" (gdtselector(UDATA_DES) | PL_USER), |
56 | "i" (gdtselector(UDATA_DES) | PL_USER), |
61 | "i" (USTACK_ADDRESS+THREAD_STACK_SIZE), |
57 | "r" (uarg->uspace_stack+THREAD_STACK_SIZE), |
62 | "r" (ipl), |
58 | "r" (ipl), |
63 | "i" (gdtselector(UTEXT_DES) | PL_USER), |
59 | "i" (gdtselector(UTEXT_DES) | PL_USER), |
64 | "r" (entry)); |
60 | "r" (uarg->uspace_entry)); |
65 | 61 | ||
66 | /* Unreachable */ |
62 | /* Unreachable */ |
67 | for(;;); |
63 | for(;;); |
68 | } |
64 | } |