08c8bb0d217b509e829a3c2ce1e477fc3731d655
[AROS.git] / arch / arm-raspi / exec / userstate.c
blob08c8bb0d217b509e829a3c2ce1e477fc3731d655
1 /*
2 Copyright © 2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: UserState() - Return to normal mode after changing things.
6 Lang: english
7 */
9 /*****************************************************************************
11 NAME */
12 #include <proto/exec.h>
14 AROS_LH1(void, UserState,
16 /* SYNOPSIS */
17 AROS_LHA(APTR, superSP, D0),
19 /* LOCATION */
20 struct ExecBase *, SysBase, 26, Exec)
22 /* FUNCTION
23 Return to user mode after a call to SuperState().
25 INPUTS
26 superSP - The return value from SuperState()
28 RESULT
29 The system will be back to normal.
31 NOTES
33 EXAMPLE
35 BUGS
37 SEE ALSO
38 SuperState(), Supervisor()
40 INTERNALS
41 Undo SuperState()
43 ******************************************************************************/
45 AROS_LIBFUNC_INIT
47 if (superSP)
49 asm volatile (
50 " stmfd sp!, {lr} \n"
51 " mov r1, sp \n"
52 " mov sp, %[superSP] \n"
53 " cpsie i, %[mode_user] \n"
54 " mov sp, r1 \n"
55 " ldmfd sp!, {lr} \n"
56 : : [superSP] "r" (superSP), [mode_user] "I" (CPUMODE_USER) : "r1" );
58 AROS_LIBFUNC_EXIT
59 } /* UserState() */