2 #include <aros/debug.h>
3 #include <aros/libcall.h>
4 #include <aros/symbolsets.h>
6 #include <proto/exec.h>
8 #include "m680x0_intern.h"
10 extern void sp060_init(void);
12 static AROS_UFH2(struct Library
*, OpenLib
,
13 AROS_UFHA(ULONG
, version
, D0
),
14 AROS_UFHA(struct Library
*, base
, A6
))
24 static AROS_UFH1(void, CloseLib
,
25 AROS_UFHA(struct Library
*, base
, A6
))
34 static AROS_UFH1(ULONG
, DummyLib
,
35 AROS_UFHA(struct Library
*, base
, A6
))
44 /* This is totally undocumented so complain if something calls our functions */
46 static AROS_UFH1(ULONG, x, \
47 AROS_UFHA(struct Library*, base, A6)) { \
49 bug("680x0: " #x "\n"); \
67 static const APTR funcLib
[] = {
68 OpenLib
, CloseLib
, DummyLib
, DummyLib
,
83 static const UBYTE lib68040
[] = "68040.library";
84 static const UBYTE lib68060
[] = "68060.library";
86 /* m68k identify.library calls these, purpose unknown */
87 AROS_LH0(ULONG
, Dummy1
, struct M680x0Base
*, M680x0Base
, 5, m680x0
)
90 bug("680x0: dummy1\n");
94 AROS_LH0(ULONG
, Dummy2
, struct M680x0Base
*, M680x0Base
, 6, m680x0
)
97 bug("680x0: dummy2\n");
101 AROS_LH0(ULONG
, Dummy3
, struct M680x0Base
*, M680x0Base
, 7, m680x0
)
104 bug("680x0: dummy3\n");
108 AROS_LH0(ULONG
, Dummy4
, struct M680x0Base
*, M680x0Base
, 8, m680x0
)
111 bug("680x0: dummy4\n");
116 static int M680x0Init(struct M680x0Base
*M680x0Base
)
120 if (!(SysBase
->AttnFlags
& (AFF_68040
| AFF_68060
)))
121 return FALSE
; /* 68040/060 only need emulation */
122 if (SysBase
->AttnFlags
& AFF_68882
)
123 return FALSE
; /* we already have full support? */
124 if (!(SysBase
->AttnFlags
& AFF_FPU40
))
125 return FALSE
; /* no FPU, don't bother with missing instruction emulation */
127 /* initialize emulation here */
130 /* Create fake 68040/060.library, stops C:SetPatch from attempting to load
131 * incompatible 68040/060 libraries.
133 * We also create both 68040 and 68060.library if 68060 is detected, it prevents
134 * old SetPatch versions (that do not know about 68060) from loading 68040.library.
136 * (Maybe this is getting too far..)
138 if (SysBase
->AttnFlags
& AFF_68060
) {
139 lib
= MakeLibrary(funcLib
, NULL
, NULL
, sizeof(struct Library
), BNULL
);
141 lib
->lib_Node
.ln_Name
= (UBYTE
*)lib68060
;
142 lib
->lib_IdString
= lib
->lib_Node
.ln_Name
;
143 lib
->lib_Version
= M680x0Base
->pb_LibNode
.lib_Version
;
144 lib
->lib_Revision
= M680x0Base
->pb_LibNode
.lib_Revision
;
145 lib
->lib_OpenCnt
= 1;
149 lib
= MakeLibrary(funcLib
, NULL
, NULL
, sizeof(struct Library
), BNULL
);
151 lib
->lib_Node
.ln_Name
= (UBYTE
*)lib68040
;
152 lib
->lib_IdString
= lib
->lib_Node
.ln_Name
;
153 lib
->lib_Version
= M680x0Base
->pb_LibNode
.lib_Version
;
154 lib
->lib_Revision
= M680x0Base
->pb_LibNode
.lib_Revision
;
155 lib
->lib_OpenCnt
= 1;
159 /* emulation installed, full 68881/68882 instruction set now supported */
160 SysBase
->AttnFlags
|= AFF_68881
| AFF_68882
;
161 /* do not expunge us */
162 M680x0Base
->pb_LibNode
.lib_OpenCnt
++;
166 ADD2INITLIB(M680x0Init
, 0)