Subversion Repositories HelenOS-historic

Rev

Rev 1066 | Rev 1112 | 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
 
48
    __asm__ volatile (
48
    __asm__ volatile (
-
 
49
        /*
-
 
50
         * Clear nested task flag.
49
        /* CLNT */
51
         */
50
        "pushfl\n"
52
        "pushfl\n"
51
        "pop %%eax\n"
53
        "pop %%eax\n"
52
        "and $0xffffbfff,%%eax\n"
54
        "and $0xffffbfff, %%eax\n"
53
        "push %%eax\n"
55
        "push %%eax\n"
54
        "popfl\n"
56
        "popfl\n"
55
 
57
 
56
        "pushl %0\n"
58
        "pushl %0\n"
57
        "pushl %1\n"
59
        "pushl %1\n"
58
        "pushl %2\n"
60
        "pushl %2\n"
59
        "pushl %3\n"
61
        "pushl %3\n"
60
        "pushl %4\n"
62
        "pushl %4\n"
-
 
63
        "movl %5, %%eax\n"
61
        "iret"
64
        "iret"
62
        :
65
        :
63
        : "i" (selector(UDATA_DES) | PL_USER), "r" (uarg->uspace_stack+THREAD_STACK_SIZE),
66
        : "i" (selector(UDATA_DES) | PL_USER), "r" (kernel_uarg->uspace_stack+THREAD_STACK_SIZE),
64
          "r" (ipl), "i" (selector(UTEXT_DES) | PL_USER), "r" (uarg->uspace_entry)
67
          "r" (ipl), "i" (selector(UTEXT_DES) | PL_USER), "r" (kernel_uarg->uspace_entry),
-
 
68
          "r" (kernel_uarg->uspace_uarg)
65
        : "eax");
69
        : "eax");
66
   
70
   
67
    /* Unreachable */
71
    /* Unreachable */
68
    for(;;)
72
    for(;;)
69
        ;
73
        ;