Subversion Repositories HelenOS

Rev

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

Rev 3022 Rev 4055
Line 68... Line 68...
68
    volatile ustate_t ustate;
68
    volatile ustate_t ustate;
69
 
69
 
70
    /* set first parameter */
70
    /* set first parameter */
71
    ustate.r0 = (uintptr_t) kernel_uarg->uspace_uarg;
71
    ustate.r0 = (uintptr_t) kernel_uarg->uspace_uarg;
72
 
72
 
-
 
73
    /* %r1 is defined to hold pcb_ptr - set it to 0 */
-
 
74
    ustate.r1 = 0;
-
 
75
 
73
    /* clear other registers */
76
    /* clear other registers */
74
    ustate.r1 = ustate.r2  = ustate.r3  = ustate.r4  = ustate.r5 =
77
    ustate.r2 = ustate.r3  = ustate.r4  = ustate.r5 =
75
        ustate.r6  = ustate.r7  = ustate.r8  = ustate.r9 = ustate.r10 =
78
        ustate.r6  = ustate.r7  = ustate.r8  = ustate.r9 = ustate.r10 =
76
        ustate.r11 = ustate.r12 = ustate.lr = 0;
79
        ustate.r11 = ustate.r12 = ustate.lr = 0;
77
 
80
 
78
    /* set user stack */
81
    /* set user stack */
79
    ustate.sp = ((uint32_t)kernel_uarg->uspace_stack) + PAGE_SIZE;
82
    ustate.sp = ((uint32_t)kernel_uarg->uspace_stack) + PAGE_SIZE;
Line 85... Line 88...
85
    ipl_t user_mode = current_status_reg_read() &
88
    ipl_t user_mode = current_status_reg_read() &
86
        (~STATUS_REG_MODE_MASK | USER_MODE);
89
        (~STATUS_REG_MODE_MASK | USER_MODE);
87
 
90
 
88
    /* set user mode, set registers, jump */
91
    /* set user mode, set registers, jump */
89
    asm volatile (
92
    asm volatile (
90
        "mov sp, %0         \n"
93
        "mov sp, %[ustate]\n"
91
        "msr spsr_c, %1         \n"
94
        "msr spsr_c, %[user_mode]\n"
92
        "ldmfd sp!, {r0-r12, sp, lr}^   \n"
95
        "ldmfd sp!, {r0-r12, sp, lr}^\n"
93
        "ldmfd sp!, {pc}^\n"
96
        "ldmfd sp!, {pc}^\n"
94
        :
-
 
95
        : "r" (&ustate), "r" (user_mode)
97
        :: [ustate] "r" (&ustate), [user_mode] "r" (user_mode)
96
    );
98
    );
97
 
99
 
98
    /* unreachable */
100
    /* unreachable */
99
    while(1)
101
    while(1)
100
        ;
102
        ;