Skip to content

Commit 90fb2c7

Browse files
jractravisg
authored andcommitted
[m68k] Integrate Motorola Integer Software Package (68060SP), for '060
support - Add 68060SP ISP code to external/arch/m68k - Install _060_isp_unimp handler for "Unimplemented Integer Instruction" exception - Add 68060 CPU target
1 parent a23d202 commit 90fb2c7

File tree

6 files changed

+1098
-1
lines changed

6 files changed

+1098
-1
lines changed

arch/m68k/exceptions_asm.S

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
// so it's easy to just vector most of the handlers into one of a few classes of handlers
1515
// and decode the vector in C.
1616

17+
.weak _060_isp_unimp
18+
_060_isp_unimp:
19+
1720
.align 4
1821
_m68k_irq_vector:
1922
// TODO: save less state for IRQs
@@ -71,7 +74,13 @@ DATA(exc_vectors)
7174
.endr
7275
.org (48 * 4)
7376
// start of FPU, MMU vectors
74-
.rept (64 - 48)
77+
.rept (61 - 48)
78+
.long _m68k_general_exception
79+
.endr
80+
.org (61 * 4)
81+
.long _060_isp_unimp
82+
.org (62 * 4)
83+
.rept (64 - 62)
7584
.long _m68k_general_exception
7685
.endr
7786
.org (64 * 4) // offset 0x100

arch/m68k/rules.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,18 @@ else ifeq ($(M68K_CPU),68030)
3232
ARCH_COMPILEFLAGS := -mcpu=68030
3333
else ifeq ($(M68K_CPU),68040)
3434
ARCH_COMPILEFLAGS := -mcpu=68040
35+
else ifeq ($(M68K_CPU),68060)
36+
ARCH_COMPILEFLAGS := -mcpu=68060
3537
else
3638
$(error add support for selected cpu $(M68K_CPU))
3739
endif
3840

41+
M68K_68060SP := $(filter 68020 68030 68040 68060,$(M68K_CPU))
42+
43+
ifneq ($(M68K_68060SP),)
44+
MODULE_DEPS += arch/m68k/68060SP
45+
endif
46+
3947
LIBGCC := $(shell $(TOOLCHAIN_PREFIX)gcc $(GLOBAL_COMPILEFLAGS) $(ARCH_COMPILEFLAGS) $(GLOBAL_COMPILEFLAGS) -print-libgcc-file-name)
4048
$(info LIBGCC = $(LIBGCC))
4149

Lines changed: 293 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,293 @@
1+
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2+
|MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
3+
|M68000 Hi-Performance Microprocessor Division
4+
|M68060 Software Package
5+
|Production Release P1.00 -- October 10, 1994
6+
|
7+
|M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8+
|
9+
|THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10+
|To the maximum extent permitted by applicable law,
11+
|MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
12+
|INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
13+
|and any warranty against infringement with regard to the SOFTWARE
14+
|(INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
15+
|
16+
|To the maximum extent permitted by applicable law,
17+
|IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
18+
|(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
19+
|BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
20+
|ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
21+
|Motorola assumes no responsibility for the maintenance and support of the SOFTWARE.
22+
|
23+
|You are hereby granted a copyright license to use, modify, and distribute the SOFTWARE
24+
|so long as this entire notice is retained without alteration in any modified and/or
25+
|redistributed versions, and that such modified versions are clearly identified as such.
26+
|No licenses are granted by implication, estoppel or otherwise under any patents
27+
|or trademarks of Motorola, Inc.
28+
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29+
| iskeleton.s
30+
|
31+
| This file contains:
32+
| (1) example "Call-out"s
33+
| (2) example package entry code
34+
| (3) example "Call-out" table
35+
|
36+
| littlekernel general changes:
37+
| - Removed Linux-specific includes
38+
| - Modified 'isp.sa' file path
39+
| - Convert branch instruction in _060_real_divbyzero
40+
|
41+
42+
43+
|################################
44+
| (1) EXAMPLE CALL-OUTS #
45+
| #
46+
| _060_isp_done() #
47+
| _060_real_chk() #
48+
| _060_real_divbyzero() #
49+
| #
50+
| _060_real_cas() #
51+
| _060_real_cas2() #
52+
| _060_real_lock_page() #
53+
| _060_real_unlock_page() #
54+
|################################
55+
56+
|
57+
| _060_isp_done():
58+
|
59+
| This is and example main exit point for the Unimplemented Integer
60+
| Instruction exception handler. For a normal exit, the
61+
| _isp_unimp() branches to here so that the operating system
62+
| can do any clean-up desired. The stack frame is the
63+
| Unimplemented Integer Instruction stack frame with
64+
| the PC pointing to the instruction following the instruction
65+
| just emulated.
66+
| To simply continue execution at the next instruction, just
67+
| do an "rte".
68+
|
69+
| littlekernel changes: Remove user space exception check
70+
|
71+
72+
.global _060_isp_done
73+
_060_isp_done:
74+
rte
75+
76+
|
77+
| _060_real_chk():
78+
|
79+
| This is an alternate exit point for the Unimplemented Integer
80+
| Instruction exception handler. If the instruction was a "chk2"
81+
| and the operand was out of bounds, then _isp_unimp() creates
82+
| a CHK exception stack frame from the Unimplemented Integer Instrcution
83+
| stack frame and branches to this routine.
84+
|
85+
| littlekernel changes: Call m68k_trap_exception, remove tracing check
86+
|
87+
88+
.global _060_real_chk
89+
_060_real_chk:
90+
|
91+
| CHK FRAME TRACE FRAME
92+
| ***************** *****************
93+
| * Current PC * * Current PC *
94+
| ***************** *****************
95+
| * 0x2 * 0x018 * * 0x2 * 0x024 *
96+
| ***************** *****************
97+
| * Next * * Next *
98+
| * PC * * PC *
99+
| ***************** *****************
100+
| * SR * * SR *
101+
| ***************** *****************
102+
|
103+
104+
real_chk_end:
105+
bral m68k_trap_exception
106+
107+
|
108+
| _060_real_divbyzero:
109+
|
110+
| This is an alternate exit point for the Unimplemented Integer
111+
| Instruction exception handler isp_unimp(). If the instruction is a 64-bit
112+
| integer divide where the source operand is a zero, then the _isp_unimp()
113+
| creates a Divide-by-zero exception stack frame from the Unimplemented
114+
| Integer Instruction stack frame and branches to this routine.
115+
|
116+
| Remember that a trace exception may be pending. The code below performs
117+
| no action associated with the "chk" exception. If tracing is enabled,
118+
| then it create a Trace exception stack frame from the "chk" exception
119+
| stack frame and branches to the _real_trace() entry point.
120+
|
121+
| littlekernel changes:
122+
| - bpls -> bplw in _060_real_divbyzero
123+
| - Remove tracing check
124+
|
125+
126+
.global _060_real_divbyzero
127+
_060_real_divbyzero:
128+
|
129+
| DIVBYZERO FRAME TRACE FRAME
130+
| ***************** *****************
131+
| * Current PC * * Current PC *
132+
| ***************** *****************
133+
| * 0x2 * 0x014 * * 0x2 * 0x024 *
134+
| ***************** *****************
135+
| * Next * * Next *
136+
| * PC * * PC *
137+
| ***************** *****************
138+
| * SR * * SR *
139+
| ***************** *****************
140+
|
141+
| littlekernel changes: Call m68k_trap_exception
142+
|
143+
144+
real_divbyzero_end:
145+
bral m68k_trap_exception
146+
147+
|##########################
148+
149+
|
150+
| _060_real_cas():
151+
|
152+
| Entry point for the selected cas emulation code implementation.
153+
| If the implementation provided by the 68060ISP is sufficient,
154+
| then this routine simply re-enters the package through _isp_cas.
155+
|
156+
.global _060_real_cas
157+
_060_real_cas:
158+
bral _I_CALL_TOP+0x80+0x08
159+
160+
|
161+
| _060_real_cas2():
162+
|
163+
| Entry point for the selected cas2 emulation code implementation.
164+
| If the implementation provided by the 68060ISP is sufficient,
165+
| then this routine simply re-enters the package through _isp_cas2.
166+
|
167+
.global _060_real_cas2
168+
_060_real_cas2:
169+
bral _I_CALL_TOP+0x80+0x10
170+
171+
|
172+
| _060_lock_page():
173+
|
174+
| Entry point for the operating system`s routine to "lock" a page
175+
| from being paged out. This routine is needed by the cas/cas2
176+
| algorithms so that no page faults occur within the "core" code
177+
| region. Note: the routine must lock two pages if the operand
178+
| spans two pages.
179+
| NOTE: THE ROUTINE SHOULD RETURN AN FSLW VALUE IN D0 ON FAILURE
180+
| SO THAT THE 060SP CAN CREATE A PROPER ACCESS ERROR FRAME.
181+
| Arguments:
182+
| a0 = operand address
183+
| d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user
184+
| d1 = `xxxxxxff -> longword; `xxxxxx00 -> word
185+
| Expected outputs:
186+
| d0 = 0 -> success; non-zero -> failure
187+
|
188+
.global _060_real_lock_page
189+
_060_real_lock_page:
190+
clr.l %d0
191+
rts
192+
193+
|
194+
| _060_unlock_page():
195+
|
196+
| Entry point for the operating system`s routine to "unlock" a
197+
| page that has been "locked" previously with _real_lock_page.
198+
| Note: the routine must unlock two pages if the operand spans
199+
| two pages.
200+
| Arguments:
201+
| a0 = operand address
202+
| d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user
203+
| d1 = `xxxxxxff -> longword; `xxxxxx00 -> word
204+
|
205+
206+
.global _060_real_unlock_page
207+
_060_real_unlock_page:
208+
clr.l %d0
209+
rts
210+
211+
|###########################################################################
212+
213+
|#################################
214+
| (2) EXAMPLE PACKAGE ENTRY CODE #
215+
|#################################
216+
217+
.global _060_isp_unimp
218+
_060_isp_unimp:
219+
bral _I_CALL_TOP+0x80+0x00
220+
221+
.global _060_isp_cas
222+
_060_isp_cas:
223+
bral _I_CALL_TOP+0x80+0x08
224+
225+
.global _060_isp_cas2
226+
_060_isp_cas2:
227+
bral _I_CALL_TOP+0x80+0x10
228+
229+
.global _060_isp_cas_finish
230+
_060_isp_cas_finish:
231+
bra.l _I_CALL_TOP+0x80+0x18
232+
233+
.global _060_isp_cas2_finish
234+
_060_isp_cas2_finish:
235+
bral _I_CALL_TOP+0x80+0x20
236+
237+
.global _060_isp_cas_inrange
238+
_060_isp_cas_inrange:
239+
bral _I_CALL_TOP+0x80+0x28
240+
241+
.global _060_isp_cas_terminate
242+
_060_isp_cas_terminate:
243+
bral _I_CALL_TOP+0x80+0x30
244+
245+
.global _060_isp_cas_restart
246+
_060_isp_cas_restart:
247+
bral _I_CALL_TOP+0x80+0x38
248+
249+
|###########################################################################
250+
251+
|###############################
252+
| (3) EXAMPLE CALL-OUT SECTION #
253+
|###############################
254+
255+
| The size of this section MUST be 128 bytes!!!
256+
257+
_I_CALL_TOP:
258+
.long _060_real_chk - _I_CALL_TOP
259+
.long _060_real_divbyzero - _I_CALL_TOP
260+
.long _060_real_trace - _I_CALL_TOP
261+
.long _060_real_access - _I_CALL_TOP
262+
.long _060_isp_done - _I_CALL_TOP
263+
264+
.long _060_real_cas - _I_CALL_TOP
265+
.long _060_real_cas2 - _I_CALL_TOP
266+
.long _060_real_lock_page - _I_CALL_TOP
267+
.long _060_real_unlock_page - _I_CALL_TOP
268+
269+
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
270+
.long 0x00000000, 0x00000000, 0x00000000
271+
272+
.long _060_imem_read - _I_CALL_TOP
273+
.long _060_dmem_read - _I_CALL_TOP
274+
.long _060_dmem_write - _I_CALL_TOP
275+
.long _060_imem_read_word - _I_CALL_TOP
276+
.long _060_imem_read_long - _I_CALL_TOP
277+
.long _060_dmem_read_byte - _I_CALL_TOP
278+
.long _060_dmem_read_word - _I_CALL_TOP
279+
.long _060_dmem_read_long - _I_CALL_TOP
280+
.long _060_dmem_write_byte - _I_CALL_TOP
281+
.long _060_dmem_write_word - _I_CALL_TOP
282+
.long _060_dmem_write_long - _I_CALL_TOP
283+
284+
.long 0x00000000
285+
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
286+
287+
|###########################################################################
288+
289+
| 060 INTEGER KERNEL PACKAGE MUST GO HERE!!!
290+
|
291+
| littlekernel changes: Adjust path to isp.sa in source tree
292+
|
293+
.include "external/arch/m68k/68060SP/isp.sa"

0 commit comments

Comments
 (0)