Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / ppc-sam440 / exec / cause.c
blob50df7533bebc25f62ffbf7a3240739f8d5e0b153
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>
19 #include "../kernel/kernel_intern.h"
21 AROS_LH1(void, Cause,
22 AROS_LHA(struct Interrupt *, softint, A1),
23 struct ExecBase *, SysBase, 30, Exec)
25 AROS_LIBFUNC_INIT
27 UBYTE pri;
28 Disable();
29 /* Check to ensure that this node is not already in a list. */
30 if( softint->is_Node.ln_Type != NT_SOFTINT )
32 /* Scale the priority down to a number between 0 and 4 inclusive
33 We can use that to index into exec's software interrupt lists. */
34 pri = (softint->is_Node.ln_Pri + 0x20)>>4;
36 /* We are accessing an Exec list, protect ourselves. */
37 ADDTAIL(&SysBase->SoftInts[pri].sh_List, &softint->is_Node);
38 softint->is_Node.ln_Type = NT_SOFTINT;
39 SysBase->SysFlags |= SFF_SoftInt;
41 /* If we are in usermode the software interrupt will end up
42 being triggered in Enable(). See Enable() code */
44 Enable();
46 AROS_LIBFUNC_EXIT
47 } /* Cause() */
50 AROS_UFH5(void, SoftIntDispatch,
51 AROS_UFHA(ULONG, intReady, D1),
52 AROS_UFHA(struct Custom *, custom, A0),
53 AROS_UFHA(IPTR, intData, A1),
54 AROS_UFHA(IPTR, intCode, A5),
55 AROS_UFHA(struct ExecBase *, SysBase, A6))
57 AROS_USERFUNC_INIT
59 void *KernelBase = getKernelBase();
61 struct Interrupt *intr = 0;
62 BYTE i;
64 if( SysBase->SysFlags & SFF_SoftInt )
66 /* Clear the Software interrupt pending flag. */
67 SysBase->SysFlags &= ~(SFF_SoftInt);
69 for(;;)
71 for(i=4; i>=0; i--)
73 KrnCli();
74 intr = (struct Interrupt *)RemHead(&SysBase->SoftInts[i].sh_List);
76 if (intr)
78 intr->is_Node.ln_Type = NT_INTERRUPT;
80 KrnSti();
82 /* Call the software interrupt. */
83 AROS_UFC3(void, intr->is_Code,
84 AROS_UFCA(APTR, intr->is_Data, A1),
85 AROS_UFCA(APTR, intr->is_Code, A5),
86 AROS_UFCA(struct ExecBase *, SysBase, A6));
88 /* Get out and start loop *all* over again *from scratch*! */
89 break;
93 if (!intr) break;
96 AROS_USERFUNC_EXIT