use for all targets
[AROS.git] / arch / arm-native / exec / userstate.c
blob3b5f5bffa75e57b6a36aab03e8135f392ca95f77
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 #include <proto/exec.h>
11 /* See rom/exec/userstate.c for documentation */
13 AROS_LH1(void, UserState,
14 AROS_LHA(APTR, superSP, D0),
15 struct ExecBase *, SysBase, 26, Exec)
17 AROS_LIBFUNC_INIT
19 if (superSP)
21 asm volatile (
22 " stmfd sp!, {lr} \n"
23 " mov r1, sp \n"
24 " mov sp, %[superSP] \n"
25 " cpsie i, %[mode_user] \n"
26 " mov sp, r1 \n"
27 " ldmfd sp!, {lr} \n"
28 : : [superSP] "r" (superSP), [mode_user] "I" (CPUMODE_USER) : "r1" );
30 AROS_LIBFUNC_EXIT
31 } /* UserState() */