ae8c9e4a2b15b1e4f6d5ac265e96dab92fe2796c
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Open a file with the specified mode.
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"
22 extern void BCPL_thunk(void);
23 #define __is_process(task) (((struct Task *)task)->tc_Node.ln_Type == NT_PROCESS)
25 /*****************************************************************************
28 #include <proto/dos.h>
30 AROS_UFH5(LONG
, CallGlobVec
,
33 AROS_UFHA(LONG
, function
, D0
),
34 AROS_UFHA(LONG
, d1
, D1
),
35 AROS_UFHA(LONG
, d2
, D2
),
36 AROS_UFHA(LONG
, d3
, D3
),
37 AROS_UFHA(LONG
, d4
, D4
)
43 Private function to call a BCPL routine from C
46 function - BCPL Global Vector function index
47 d1..d4 - Parameter to the function
50 return value of the BCPL routine
53 This works only on m68k.
63 *****************************************************************************/
67 struct Process
*me
= (struct Process
*)FindTask(NULL
);
71 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
));
73 if (!__is_process(me
))
76 oldReturnAddr
= me
->pr_ReturnAddr
;
77 ret
= AROS_UFC8(LONG
, BCPL_thunk
,
78 AROS_UFCA(LONG
, d1
, D1
),
79 AROS_UFCA(LONG
, d2
, D2
),
80 AROS_UFCA(LONG
, d3
, D3
),
81 AROS_UFCA(LONG
, d4
, D4
),
82 AROS_UFCA(APTR
, me
->pr_Task
.tc_SPLower
, A1
),
83 AROS_UFCA(APTR
, me
->pr_GlobVec
, A2
),
84 AROS_UFCA(APTR
, &me
->pr_ReturnAddr
, A3
),
85 AROS_UFCA(LONG_FUNC
, ((LONG_FUNC
*)me
->pr_GlobVec
)[function
], A4
));
86 me
->pr_ReturnAddr
= oldReturnAddr
;