Rev 534 | Rev 938 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 534 | Rev 703 | ||
|---|---|---|---|
| Line 29... | Line 29... | ||
| 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/thread.h> |
| 34 | #include <mm/vm.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. |
| Line 45... | Line 45... | ||
| 45 | 45 | ||
| 46 | ipl = interrupts_disable(); |
46 | ipl = interrupts_disable(); |
| 47 | 47 | ||
| 48 | __asm__ volatile ( |
48 | __asm__ volatile ( |
| 49 | /* CLNT */ |
49 | /* CLNT */ |
| 50 | "pushfl;" |
50 | "pushfl\n" |
| 51 | "pop %%eax;" |
51 | "pop %%eax\n" |
| 52 | "and $0xFFFFBFFF,%%eax;" |
52 | "and $0xffffbfff,%%eax\n" |
| 53 | "push %%eax;" |
53 | "push %%eax\n" |
| 54 | "popfl;" |
54 | "popfl\n" |
| 55 | 55 | ||
| 56 | "pushl %0\n" |
56 | "pushl %0\n" |
| 57 | "pushl %1\n" |
57 | "pushl %1\n" |
| 58 | "pushl %2\n" |
58 | "pushl %2\n" |
| 59 | "pushl %3\n" |
59 | "pushl %3\n" |
| Line 62... | Line 62... | ||
| 62 | : |
62 | : |
| 63 | : "i" (selector(UDATA_DES) | PL_USER), "r" (USTACK_ADDRESS+(THREAD_STACK_SIZE)), "r" (ipl), "i" (selector(UTEXT_DES) | PL_USER), "i" (UTEXT_ADDRESS) |
63 | : "i" (selector(UDATA_DES) | PL_USER), "r" (USTACK_ADDRESS+(THREAD_STACK_SIZE)), "r" (ipl), "i" (selector(UTEXT_DES) | PL_USER), "i" (UTEXT_ADDRESS) |
| 64 | : "eax"); |
64 | : "eax"); |
| 65 | 65 | ||
| 66 | /* Unreachable */ |
66 | /* Unreachable */ |
| 67 | for(;;); |
67 | for(;;) |
| - | 68 | ; |
|
| 68 | } |
69 | } |