xref: /netbsd/sys/arch/m68k/060sp/dist/isp.doc (revision bf9ec67e)
1#
2# $NetBSD: isp.doc,v 1.1 2000/04/14 20:24:39 is Exp $
3#
4
5#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
7# M68000 Hi-Performance Microprocessor Division
8# M68060 Software Package Production Release
9#
10# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
11# All rights reserved.
12#
13# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
14# To the maximum extent permitted by applicable law,
15# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
16# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
17# FOR A PARTICULAR PURPOSE and any warranty against infringement with
18# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
19# and any accompanying written materials.
20#
21# To the maximum extent permitted by applicable law,
22# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
23# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
24# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
25# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
26#
27# Motorola assumes no responsibility for the maintenance and support
28# of the SOFTWARE.
29#
30# You are hereby granted a copyright license to use, modify, and distribute the
31# SOFTWARE so long as this entire notice is retained without alteration
32# in any modified and/or redistributed versions, and that such modified
33# versions are clearly identified as such.
34# No licenses are granted by implication, estoppel or otherwise under any
35# patents or trademarks of Motorola, Inc.
36#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37
3868060 INTEGER SOFTWARE PACKAGE (Kernel version)
39------------------------------------------------
40
41The file isp.sa contains the 68060 Integer Software Package.
42This package is essentially an exception handler that can be
43integrated into an operating system to handle the "Unimplemented
44Integer Instruction" exception vector #61.
45This exception is taken when any of the integer instructions
46not hardware implemented on the 68060 are encountered. The
47isp.sa provides full emulation support for these instructions.
48
49The unimplemented integer instructions are:
50	64-bit divide
51	64-bit multiply
52	movep
53	cmp2
54	chk2
55	cas (w/ a misaligned effective address)
56	cas2
57
58Release file format:
59--------------------
60The file isp.sa is essentially a hexadecimal image of the
61release package. This is the ONLY format which will be supported.
62The hex image was created by assembling the source code and
63then converting the resulting binary output image into an
64ASCII text file. The hexadecimal numbers are listed
65using the Motorola Assembly Syntax assembler directive "dc.l"
66(define constant longword). The file can be converted to other
67assembly syntaxes by using any word processor with a global
68search and replace function.
69
70To assist in assembling and linking this module with other modules,
71the installer should add a symbolic label to the top of the file.
72This will allow calling routines to access the entry points
73of this package.
74
75The source code isp.s has also been included but only for
76documentation purposes.
77
78Release file structure:
79-----------------------
80
81(top of module)
82	-----------------
83	|		| - 128 byte-sized section
84   (1)  |   Call-Out    | - 4 bytes per entry (user fills these in)
85	|		| - example routines in iskeleton.s
86	-----------------
87	|		| - 8 bytes per entry
88   (2)  | Entry Point   | - user does a "bra" or "jmp" to this address
89	|               |
90	-----------------
91	|		| - code section
92   (3)  ~		~
93	|		|
94	-----------------
95(bottom of module)
96
97The first section of this module is the "Call-out" section. This section
98is NOT INCLUDED in isp.sa (an example "Call-out" section is provided at
99the end of the file iskeleton.s). The purpose of this section is to allow
100the ISP routines to reference external functions that must be provided
101by the host operating system. This section MUST be exactly 128 bytes in
102size. There are 32 fields, each 4 bytes in size. Each field corresponds
103to a function required by the ISP (these functions and their location are
104listed in "68060ISP call-outs" below). Each field entry should contain
105the address of the corresponding function RELATIVE to the starting address
106of the "call-out" section. The "Call-out" section must sit adjacent to the
107isp.sa image in memory.
108
109The second section, the "Entry-point" section, is used by external routines
110to access the functions within the ISP. Since the isp.sa hex file contains
111no symbol names, this section contains function entry points that are fixed
112with respect to the top of the package. The currently defined entry-points
113are listed in section "68060 ISP entry points" below. A calling routine
114would simply execute a "bra" or "jmp" that jumped to the selected function
115entry-point.
116
117For example, if the 68060 hardware took a "Unimplemented Integer Instruction"
118exception (vector #61), the operating system should execute something
119similar to:
120
121	bra	_060ISP_TOP+128+0
122
123(_060ISP_TOP is the starting address of the "Call-out" section; the "Call-out"
124section is 128 bytes long; and the Unimplemented Integer ISP handler entry
125point is located 0 bytes from the top of the "Entry-point" section.)
126
127The third section is the code section. After entering through an "Entry-point",
128the entry code jumps to the appropriate emulation code within the code section.
129
13068060ISP call-outs: (details in iskeleton.s)
131--------------------
1320x000:	_060_real_chk
1330x004:	_060_real_divbyzero
1340x008:	_060_real_trace
1350x00c:	_060_real_access
1360x010:	_060_isp_done
137
1380x014:	_060_real_cas
1390x018:	_060_real_cas2
1400x01c:	_060_real_lock_page
1410x020:	_060_real_unlock_page
142
1430x024:	(Motorola reserved)
1440x028:	(Motorola reserved)
1450x02c:	(Motorola reserved)
1460x030:	(Motorola reserved)
1470x034:	(Motorola reserved)
1480x038:	(Motorola reserved)
1490x03c:	(Motorola reserved)
150
1510x040:	_060_imem_read
1520x044:	_060_dmem_read
1530x048:	_060_dmem_write
1540x04c:	_060_imem_read_word
1550x050:	_060_imem_read_long
1560x054:	_060_dmem_read_byte
1570x058:	_060_dmem_read_word
1580x05c:	_060_dmem_read_long
1590x060:	_060_dmem_write_byte
1600x064:	_060_dmem_write_word
1610x068:	_060_dmem_write_long
162
1630x06c:	(Motorola reserved)
1640x070:	(Motorola reserved)
1650x074:	(Motorola reserved)
1660x078:	(Motorola reserved)
1670x07c:	(Motorola reserved)
168
16968060ISP entry points:
170-----------------------
1710x000:	_060_isp_unimp
172
1730x008:	_060_isp_cas
1740x010:	_060_isp_cas2
1750x018:	_060_isp_cas_finish
1760x020:	_060_isp_cas2_finish
1770x028:	_060_isp_cas_inrange
1780x030:	_060_isp_cas_terminate
1790x038:	_060_isp_cas_restart
180
181Integrating cas/cas2:
182---------------------
183The instructions "cas2" and "cas" (when used with a misaligned effective
184address) take the Unimplemented Integer Instruction exception. When the
185060ISP is installed properly, these instructions will enter through the
186_060_isp_unimp() entry point of the ISP.
187
188After the 060ISP decodes the instruction type and fetches the appropriate
189data registers, and BEFORE the actual emulated transfers occur, the
190package calls either the "Call-out" _060_real_cas() or _060_real_cas2().
191If the emulation code provided by the 060ISP is sufficient for the
192host system (see isp.s source code), then these "Call-out"s should be
193made, by the system integrator, to point directly back into the package
194through the "Entry-point"s _060_isp_cas() or _060_isp_cas2().
195
196One other necessary action by the integrator is to supply the routines
197_060_real_lock_page() and _060_real_unlock_page(). These functions are
198defined further in iskeleton.s and the 68060 Software Package Specification.
199
200If the "core" emulation routines of either "cas" or "cas2" perform some
201actions which are too system-specific, then the system integrator must
202supply new emulation code. This new emulation code should reside within
203the functions _060_real_cas() or _060_real_cas2(). When this new emulation
204code has completed, then it should re-enter the 060ISP package through the
205"Entry-point" _060_isp_cas_finish() or _060_isp_cas2_finish().
206To see what the register state is upon entering _060_real_cas() or
207_060_real_cas2() and what it should be upon return to the package through
208_060_isp_cas_finish() or _060_isp_cas2_finish(), please refer to the
209source code in isp.s.
210
211Miscellaneous:
212--------------
213
214_060_isp_unimp:
215----------------
216- documented in 2.2 in spec.
217- Basic flow:
218	exception taken ---> enter _060_isp_unimp   --|
219						      |
220						      |
221            may exit through _060_real_itrace    <----|
222						  or  |
223            may exit through _060_real_chk       <----|
224						  or  |
225            may exit through _060_real_divbyzero <----|
226						  or  |
227            may exit through _060_isp_done       <----|
228