1 /* Copyright © 1995-2001, The AROS Development Team. All rights reserved.
6 * Switch the processor into user mode.
7 * Parameters to this function:
8 * function to continue with afterwards.
9 * pointer to the user stack to be used.
13 .globl switch_to_user_mode
16 move.l 0x8(%sp),%a0 // get USP
17 move.l %a0,%usp // set the USP to the new value
19 move.l %ssp,%a1 // ssp->a1 for later to access
21 lea.l in_user_mode,%a0// prepare a fake exception stack frame
22 move.l %a0,-(%ssp) // PC
23 move.w #0x0700,-(%ssp) // SR
24 rte // get the PC and SR from the exception
27 move.l 0x4(%a1),%a0 // a1 contains old ssp
28 jmp (%a0) // jump to address where to continue