Subversion Repositories HelenOS-historic

Rev

Rev 313 | Rev 501 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 313 Rev 413
Line 39... Line 39...
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(void)
42
void userspace(void)
43
{
43
{
44
    pri_t pri;
44
    ipl_t ipl;
45
   
45
   
46
    pri = cpu_priority_high();
46
    ipl = interrupts_disable();
47
 
47
 
48
    __asm__ volatile (""
48
    __asm__ volatile (""
49
              "movq %0, %%rax;"            
49
              "movq %0, %%rax;"            
50
              "movq %1, %%rbx;"
50
              "movq %1, %%rbx;"
51
              "movq %2, %%rcx;"
51
              "movq %2, %%rcx;"
Line 55... Line 55...
55
              "pushq %%rbx;"
55
              "pushq %%rbx;"
56
              "pushq %%rcx;"
56
              "pushq %%rcx;"
57
              "pushq %%rdx;"
57
              "pushq %%rdx;"
58
              "pushq %%rsi;"
58
              "pushq %%rsi;"
59
              "iretq;"
59
              "iretq;"
60
              : : "i" (gdtselector(UDATA_DES) | PL_USER), "i" (USTACK_ADDRESS+THREAD_STACK_SIZE), "r" (pri), "i" (gdtselector(UTEXT_DES) | PL_USER), "i" (UTEXT_ADDRESS));
60
              : : "i" (gdtselector(UDATA_DES) | PL_USER), "i" (USTACK_ADDRESS+THREAD_STACK_SIZE), "r" (ipl), "i" (gdtselector(UTEXT_DES) | PL_USER), "i" (UTEXT_ADDRESS));
61
   
61
   
62
    /* Unreachable */
62
    /* Unreachable */
63
    for(;;);
63
    for(;;);
64
}
64
}