add a missing section header table index conversion
[tangerine.git] / arch / x86_64-pc / exec / cause.c
blob068325ea9db67675fa3c899ddbc279221cdac08d
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id: cause.c 22006 2004-08-05 19:06:53Z stegerg $
5 Desc: i386native version of Cause().
6 Lang: english
7 */
9 #include <exec/execbase.h>
10 #include <aros/asmcall.h>
11 #include <aros/kernel.h>
12 #include <exec/interrupts.h>
13 #include <hardware/custom.h>
14 #include <hardware/intbits.h>
15 #include <proto/exec.h>
16 #include <proto/kernel.h>
18 #include <exec_intern.h>
20 AROS_LH1(void, Cause,
21 AROS_LHA(struct Interrupt *, softint, A1),
22 struct ExecBase *, SysBase, 30, Exec)
24 AROS_LIBFUNC_INIT
26 UBYTE pri;
27 Disable();
28 /* Check to ensure that this node is not already in a list. */
29 if( softint->is_Node.ln_Type != NT_SOFTINT )
31 /* Scale the priority down to a number between 0 and 4 inclusive
32 We can use that to index into exec's software interrupt lists. */
33 pri = (softint->is_Node.ln_Pri + 0x20)>>4;
35 /* We are accessing an Exec list, protect ourselves. */
36 ADDTAIL(&SysBase->SoftInts[pri].sh_List, &softint->is_Node);
37 softint->is_Node.ln_Type = NT_SOFTINT;
38 SysBase->SysFlags |= SFF_SoftInt;
40 /* If we are in usermode the software interrupt will end up
41 being triggered in Enable(). See Enable() code */
43 Enable();
45 AROS_LIBFUNC_EXIT
46 } /* Cause() */
49 AROS_UFH5(void, SoftIntDispatch,
50 AROS_UFHA(ULONG, intReady, D1),
51 AROS_UFHA(struct Custom *, custom, A0),
52 AROS_UFHA(IPTR, intData, A1),
53 AROS_UFHA(IPTR, intCode, A5),
54 AROS_UFHA(struct ExecBase *, SysBase, A6))
56 AROS_USERFUNC_INIT
58 void *KernelBase = TLS_GET(KernelBase);
60 struct Interrupt *intr = 0;
61 BYTE i;
63 if( SysBase->SysFlags & SFF_SoftInt )
65 /* Clear the Software interrupt pending flag. */
66 SysBase->SysFlags &= ~(SFF_SoftInt);
68 for(;;)
70 for(i=4; i>=0; i--)
72 KrnCli();
73 intr = (struct Interrupt *)RemHead(&SysBase->SoftInts[i].sh_List);
75 if (intr)
77 intr->is_Node.ln_Type = NT_INTERRUPT;
79 KrnSti();
81 /* Call the software interrupt. */
82 AROS_UFC3(void, intr->is_Code,
83 AROS_UFCA(APTR, intr->is_Data, A1),
84 AROS_UFCA(APTR, intr->is_Code, A5),
85 AROS_UFCA(struct ExecBase *, SysBase, A6));
87 /* Get out and start loop *all* over again *from scratch*! */
88 break;
92 if (!intr) break;
95 AROS_USERFUNC_EXIT