2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
7 #include <aros/libcall.h>
8 #include <aros/symbolsets.h>
10 #include <proto/exec.h>
12 #include "m680x0_intern.h"
14 extern void sp060_init(void);
16 static AROS_UFH2(struct Library
*, OpenLib
,
17 AROS_UFHA(ULONG
, version
, D0
),
18 AROS_UFHA(struct Library
*, base
, A6
))
28 static AROS_UFH1(void, CloseLib
,
29 AROS_UFHA(struct Library
*, base
, A6
))
38 static AROS_UFH1(ULONG
, DummyLib
,
39 AROS_UFHA(struct Library
*, base
, A6
))
48 /* This is totally undocumented so complain if something calls our functions */
50 static AROS_UFH1(ULONG, x, \
51 AROS_UFHA(struct Library*, base, A6)) { \
53 bug("680x0: " #x "\n"); \
71 static const APTR funcLib
[] = {
72 OpenLib
, CloseLib
, DummyLib
, DummyLib
,
87 static const UBYTE lib68040
[] = "68040.library";
88 static const UBYTE lib68060
[] = "68060.library";
90 /* m68k identify.library calls these, purpose unknown */
91 AROS_LH0(ULONG
, Dummy1
, struct M680x0Base
*, M680x0Base
, 5, m680x0
)
94 bug("680x0: dummy1\n");
98 AROS_LH0(ULONG
, Dummy2
, struct M680x0Base
*, M680x0Base
, 6, m680x0
)
101 bug("680x0: dummy2\n");
105 AROS_LH0(ULONG
, Dummy3
, struct M680x0Base
*, M680x0Base
, 7, m680x0
)
108 bug("680x0: dummy3\n");
112 AROS_LH0(ULONG
, Dummy4
, struct M680x0Base
*, M680x0Base
, 8, m680x0
)
115 bug("680x0: dummy4\n");
120 static int M680x0Init(struct M680x0Base
*M680x0Base
)
124 if (!(SysBase
->AttnFlags
& (AFF_68040
| AFF_68060
)))
125 return FALSE
; /* 68040/060 only need emulation */
126 if (SysBase
->AttnFlags
& AFF_68882
)
127 return FALSE
; /* we already have full support? */
128 if (!(SysBase
->AttnFlags
& AFF_FPU40
))
129 return FALSE
; /* no FPU, don't bother with missing instruction emulation */
131 /* initialize emulation here */
134 /* Create fake 68040/060.library, stops C:SetPatch from attempting to load
135 * incompatible 68040/060 libraries.
137 * We also create both 68040 and 68060.library if 68060 is detected, it prevents
138 * old SetPatch versions (that do not know about 68060) from loading 68040.library.
140 * (Maybe this is getting too far..)
142 if (SysBase
->AttnFlags
& AFF_68060
) {
143 lib
= MakeLibrary(funcLib
, NULL
, NULL
, sizeof(struct Library
), BNULL
);
145 lib
->lib_Node
.ln_Name
= (UBYTE
*)lib68060
;
146 lib
->lib_IdString
= lib
->lib_Node
.ln_Name
;
147 lib
->lib_Version
= M680x0Base
->pb_LibNode
.lib_Version
;
148 lib
->lib_Revision
= M680x0Base
->pb_LibNode
.lib_Revision
;
149 lib
->lib_OpenCnt
= 1;
153 lib
= MakeLibrary(funcLib
, NULL
, NULL
, sizeof(struct Library
), BNULL
);
155 lib
->lib_Node
.ln_Name
= (UBYTE
*)lib68040
;
156 lib
->lib_IdString
= lib
->lib_Node
.ln_Name
;
157 lib
->lib_Version
= M680x0Base
->pb_LibNode
.lib_Version
;
158 lib
->lib_Revision
= M680x0Base
->pb_LibNode
.lib_Revision
;
159 lib
->lib_OpenCnt
= 1;
163 /* emulation installed, full 68881/68882 instruction set now supported */
164 SysBase
->AttnFlags
|= AFF_68881
| AFF_68882
;
165 /* do not expunge us */
166 M680x0Base
->pb_LibNode
.lib_OpenCnt
++;
170 ADD2INITLIB(M680x0Init
, 0)