Fix issues with flexcat file paths
[AROS.git] / arch / m68k-mac / exec / switchtouser.S
blob4e0d0c356ddeae684d5b65cf1d22aa1ab0a66ae2
1 /*   Copyright © 1995-2001, The AROS Development Team. All rights reserved.
2     $Id$
3 */
5         /*
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.
10          */
11         .text
12         .balign 16
13         .globl  switch_to_user_mode
15 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
25                                 // stack frame
26 in_user_mode:
27         move.l  0x4(%a1),%a0    // a1 contains old ssp
28         jmp     (%a0)           // jump to address where to continue