revert between 56095 -> 55830 in arch
[AROS.git] / rom / exec / setintvector.c
blobc9e531922e97110fe67507f65878afaccda849fe
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Install an interrupt handler.
6 Lang: english
7 */
8 #include <exec/execbase.h>
9 #include <exec/interrupts.h>
10 #include <proto/exec.h>
11 #include <aros/libcall.h>
13 #include "exec_intern.h"
14 #include "exec_debug.h"
15 #include "exec_locks.h"
17 /*****************************************************************************
19 NAME */
21 AROS_LH2(struct Interrupt *, SetIntVector,
23 /* SYNOPSIS */
24 AROS_LHA(ULONG, intNumber, D0),
25 AROS_LHA(struct Interrupt *, interrupt, A1),
27 /* LOCATION */
28 struct ExecBase *, SysBase, 27, Exec)
30 /* FUNCTION
32 INPUTS
34 RESULT
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
44 INTERNALS
46 ******************************************************************************/
48 AROS_LIBFUNC_INIT
49 struct Interrupt *oldint;
50 BOOL ishandler = intNumber <= 2 || (intNumber >= 6 && intNumber <= 12);
52 ExecLog(SysBase, EXECDEBUGF_EXCEPTHANDLER, "SetIntVector: Int %d, Interrupt %p\n", intNumber, interrupt);
54 EXEC_LOCK_LIST_WRITE_AND_DISABLE(&SysBase->IntrList);
56 oldint = (struct Interrupt *)SysBase->IntVects[intNumber].iv_Node;
57 SysBase->IntVects[intNumber].iv_Node = ishandler ? (struct Node *)interrupt : NULL;
59 if (interrupt)
61 SysBase->IntVects[intNumber].iv_Data = interrupt->is_Data;
62 SysBase->IntVects[intNumber].iv_Code = interrupt->is_Code;
64 else
66 SysBase->IntVects[intNumber].iv_Data = (APTR)~0;
67 SysBase->IntVects[intNumber].iv_Code = (void *)~0;
70 EXEC_UNLOCK_LIST_AND_ENABLE(&SysBase->IntrList);
72 return oldint;
74 AROS_LIBFUNC_EXIT
75 } /* SetIntVector */