Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / ppc-chrp / exec / cause.c
blob31f6f9bcbb617dbc0786b3f81fbaa7c322e9d81d
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
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 extern void *priv_KernelBase;
22 AROS_LH1(void, Cause,
23 AROS_LHA(struct Interrupt *, softint, A1),
24 struct ExecBase *, SysBase, 30, Exec)
26 AROS_LIBFUNC_INIT
28 UBYTE pri;
29 Disable();
30 /* Check to ensure that this node is not already in a list. */
31 if( softint->is_Node.ln_Type != NT_SOFTINT )
33 /* Scale the priority down to a number between 0 and 4 inclusive
34 We can use that to index into exec's software interrupt lists. */
35 pri = (softint->is_Node.ln_Pri + 0x20)>>4;
37 /* We are accessing an Exec list, protect ourselves. */
38 ADDTAIL(&SysBase->SoftInts[pri].sh_List, &softint->is_Node);
39 softint->is_Node.ln_Type = NT_SOFTINT;
40 SysBase->SysFlags |= SFF_SoftInt;
42 /* If we are in usermode the software interrupt will end up
43 being triggered in Enable(). See Enable() code */
45 Enable();
47 AROS_LIBFUNC_EXIT
48 } /* Cause() */
51 AROS_UFH5(void, SoftIntDispatch,
52 AROS_UFHA(ULONG, intReady, D1),
53 AROS_UFHA(struct Custom *, custom, A0),
54 AROS_UFHA(IPTR, intData, A1),
55 AROS_UFHA(IPTR, intCode, A5),
56 AROS_UFHA(struct ExecBase *, SysBase, A6))
58 AROS_USERFUNC_INIT
60 void *KernelBase = priv_KernelBase;
62 struct Interrupt *intr = 0;
63 BYTE i;
65 if( SysBase->SysFlags & SFF_SoftInt )
67 /* Clear the Software interrupt pending flag. */
68 SysBase->SysFlags &= ~(SFF_SoftInt);
70 for(;;)
72 for(i=4; i>=0; i--)
74 KrnCli();
75 intr = (struct Interrupt *)RemHead(&SysBase->SoftInts[i].sh_List);
77 if (intr)
79 intr->is_Node.ln_Type = NT_INTERRUPT;
81 KrnSti();
83 /* Call the software interrupt. */
84 AROS_UFC3(void, intr->is_Code,
85 AROS_UFCA(APTR, intr->is_Data, A1),
86 AROS_UFCA(APTR, intr->is_Code, A5),
87 AROS_UFCA(struct ExecBase *, SysBase, A6));
89 /* Get out and start loop *all* over again *from scratch*! */
90 break;
94 if (!intr) break;
97 AROS_USERFUNC_EXIT