revert between 56095 -> 55830 in arch
[AROS.git] / arch / m68k-all / dos / callglobvec.c
blob3d807973ed7a420ee37bb43f38d067ff435a89f6
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Open a file with the specified mode.
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <exec/memory.h>
11 #include <exec/lists.h>
12 #include <proto/exec.h>
13 #include <utility/tagitem.h>
14 #include <dos/dosextens.h>
15 #include <dos/stdio.h>
16 #include <proto/dos.h>
17 #include <proto/utility.h>
19 #include "dos_intern.h"
20 #include "bcpl.h"
22 extern void BCPL_thunk(void);
23 #define __is_process(task) (((struct Task *)task)->tc_Node.ln_Type == NT_PROCESS)
25 #include <proto/dos.h>
27 /* See rom/dos/callglobvec.c for documentation */
29 AROS_UFH5(LONG, CallGlobVec,
30 AROS_UFHA(LONG, function, D0),
31 AROS_UFHA(LONG, d1, D1),
32 AROS_UFHA(LONG, d2, D2),
33 AROS_UFHA(LONG, d3, D3),
34 AROS_UFHA(LONG, d4, D4))
36 AROS_USERFUNC_INIT
38 struct Process *me = (struct Process *)FindTask(NULL);
39 LONG ret;
40 APTR oldReturnAddr;
42 D(bug("%s: 0x%d (0x%x, 0x%x, 0x%x, 0x%x) GV %p\n", __func__, function, d1, d2, d3, d4, __is_process(me) ? me->pr_GlobVec : NULL));
44 if (!__is_process(me))
45 return DOSFALSE;
47 oldReturnAddr = me->pr_ReturnAddr;
48 ret = AROS_UFC8(LONG, BCPL_thunk,
49 AROS_UFCA(LONG, d1, D1),
50 AROS_UFCA(LONG, d2, D2),
51 AROS_UFCA(LONG, d3, D3),
52 AROS_UFCA(LONG, d4, D4),
53 AROS_UFCA(APTR, me->pr_Task.tc_SPLower, A1),
54 AROS_UFCA(APTR, me->pr_GlobVec, A2),
55 AROS_UFCA(APTR, &me->pr_ReturnAddr, A3),
56 AROS_UFCA(LONG_FUNC, ((LONG_FUNC *)me->pr_GlobVec)[function], A4));
57 me->pr_ReturnAddr = oldReturnAddr;
59 return ret;
61 AROS_USERFUNC_EXIT
62 } /* CallGlobVec */