revert between 56095 -> 55830 in arch
[AROS.git] / arch / .unmaintained / arm-all / exec / setsr.c
blob23045097f65f83c4fadfed5ab8b4b413570c5ffd
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: SetSR() - Modify the CPU status register.
6 Lang: english
7 */
9 #include <exec/types.h>
10 #include <exec/ptrace.h>
11 #define DEBUG 1
12 #include <aros/debug.h>
14 /*****************************************************************************
16 NAME */
17 #include <proto/exec.h>
19 AROS_LH2(ULONG, SetSR,
21 /* SYNOPSIS */
22 AROS_LHA(ULONG, newSR, D0),
23 AROS_LHA(ULONG, mask, D1),
25 /* LOCATION */
26 struct ExecBase *, SysBase, 24, Exec)
28 /* FUNCTION
29 Read/Modify the CPU status register in an easy way. Only the bits
30 set it the mask parameter will be changed.
32 The bits in the register mapped to those of the Motorola MC680x0
33 family of microprocessors.
35 INPUTS
36 newSR - The new contents of the status register.
37 mask - Mask of bits to change.
39 RESULT
40 The old contents of the status register or ~0UL if this function
41 is not implemented.
43 NOTES
44 This function is of limited use.
46 EXAMPLE
47 You can read the status register by calling SetSR(0,0).
49 BUGS
50 This function may do nothing on non-mc680x0 systems.
52 SEE ALSO
54 INTERNALS
56 HISTORY
58 ******************************************************************************/
60 AROS_LIBFUNC_INIT
61 ULONG res;
63 __asm__ __volatile__ ("swi #1");
64 return res;
66 AROS_LIBFUNC_EXIT
67 } /* SetSR() */
70 void _sys_SetSR(struct pt_regs * regs, LONG adjust)
72 ULONG new = regs->r0;
73 ULONG mask = regs->r1;
74 regs->r0 = regs->cpsr;
75 regs->cpsr = (regs->cpsr & ~mask) | (new & mask);
76 // D(bug("in _sys_SetSR! new cpsr = %x\n",regs->cpsr));