Subversion Repositories HelenOS-historic

Rev

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

Rev 315 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
        /* CLNT */
49
        /* CLNT */
50
        "pushfl;"
50
        "pushfl;"
51
        "pop %%eax;"
51
        "pop %%eax;"
Line 58... Line 58...
58
        "pushl %2\n"
58
        "pushl %2\n"
59
        "pushl %3\n"
59
        "pushl %3\n"
60
        "pushl %4\n"
60
        "pushl %4\n"
61
        "iret"
61
        "iret"
62
        :
62
        :
63
        : "i" (selector(UDATA_DES) | PL_USER), "r" (USTACK_ADDRESS+(THREAD_STACK_SIZE)), "r" (pri), "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
}