grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / exec / setintvector.c
blobd1ca9ebc6acca47aec7cd851f3796f92dbe0caec
1 /*
2 Copyright © 1995-2001, 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_debug.h"
15 /*****************************************************************************
17 NAME */
19 AROS_LH2(struct Interrupt *, SetIntVector,
21 /* SYNOPSIS */
22 AROS_LHA(ULONG, intNumber, D0),
23 AROS_LHA(struct Interrupt *, interrupt, A1),
25 /* LOCATION */
26 struct ExecBase *, SysBase, 27, Exec)
28 /* FUNCTION
30 INPUTS
32 RESULT
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
42 INTERNALS
44 ******************************************************************************/
46 AROS_LIBFUNC_INIT
47 struct Interrupt *oldint;
48 BOOL ishandler = intNumber <= 2 || (intNumber >= 6 && intNumber <= 12);
50 ExecLog(SysBase, EXECDEBUGF_EXCEPTHANDLER, "SetIntVector: Int %d, Interrupt %p\n", intNumber, interrupt);
52 Disable ();
54 oldint = (struct Interrupt *)SysBase->IntVects[intNumber].iv_Node;
55 SysBase->IntVects[intNumber].iv_Node = ishandler ? (struct Node *)interrupt : NULL;
57 if (interrupt)
59 SysBase->IntVects[intNumber].iv_Data = interrupt->is_Data;
60 SysBase->IntVects[intNumber].iv_Code = interrupt->is_Code;
62 else
64 SysBase->IntVects[intNumber].iv_Data = (APTR)~0;
65 SysBase->IntVects[intNumber].iv_Code = (void *)~0;
68 Enable ();
70 return oldint;
72 AROS_LIBFUNC_EXIT
73 } /* SetIntVector */