Annotation of sys/arch/m68k/060sp/ilsp.doc, Revision 1.1.1.1
1.1 nbrk 1: #
2: # $OpenBSD: ilsp.doc,v 1.3 2007/04/10 17:47:54 miod Exp $
3: # $NetBSD: ilsp.doc,v 1.2 1996/05/15 19:48:36 is Exp $
4: #
5:
6: #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7: # MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
8: # M68000 Hi-Performance Microprocessor Division
9: # M68060 Software Package Production Release
10: #
11: # M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
12: # All rights reserved.
13: #
14: # THE SOFTWARE is provided on an "AS IS" basis and without warranty.
15: # To the maximum extent permitted by applicable law,
16: # MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
17: # INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
18: # FOR A PARTICULAR PURPOSE and any warranty against infringement with
19: # regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
20: # and any accompanying written materials.
21: #
22: # To the maximum extent permitted by applicable law,
23: # IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
24: # (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
25: # BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
26: # ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
27: #
28: # Motorola assumes no responsibility for the maintenance and support
29: # of the SOFTWARE.
30: #
31: # You are hereby granted a copyright license to use, modify, and distribute the
32: # SOFTWARE so long as this entire notice is retained without alteration
33: # in any modified and/or redistributed versions, and that such modified
34: # versions are clearly identified as such.
35: # No licenses are granted by implication, estoppel or otherwise under any
36: # patents or trademarks of Motorola, Inc.
37: #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38:
39: 68060 INTEGER SOFTWARE PACKAGE (Library version)
40: -------------------------------------------------
41:
42: The file ilsp.s contains the "Library version" of the
43: 68060 Integer Software Package. Routines included in this
44: module can be used to emulate 64-bit divide and multiply,
45: and the "cmp2" instruction. These instructions are not
46: implemented in hardware on the 68060 and normally take
47: exception vector #61 "Unimplemented Integer Instruction".
48:
49: By re-compiling a program that uses these instructions, and
50: making subroutine calls in place of the unimplemented
51: instructions, a program can avoid the overhead associated with
52: taking the exception.
53:
54: Release file format:
55: --------------------
56: The file ilsp.sa is essentially a hexadecimal image of the
57: release package. This is the ONLY format which will be supported.
58: The hex image was created by assembling the source code and
59: then converting the resulting binary output image into an
60: ASCII text file. The hexadecimal numbers are listed
61: using the Motorola Assembly Syntax assembler directive "dc.l"
62: (define constant longword). The file can be converted to other
63: assembly syntaxes by using any word processor with a global
64: search and replace function.
65:
66: To assist in assembling and linking this module with other modules,
67: the installer should add a symbolic label to the top of the file.
68: This will allow calling routines to access the entry points
69: of this package.
70:
71: The source code ilsp.s has also been included but only for
72: documentation purposes.
73:
74: Release file structure:
75: -----------------------
76: The file ilsp.sa contains an "Entry-Point" section and a
77: code section. The ILSP has no "Call-Out" section. The first section
78: is the "Entry-Point" section. In order to access a function in the
79: package, a program must "bsr" or "jsr" to the location listed
80: below in "68060ILSP Entry Points" that corresponds to the desired
81: function. A branch instruction located at the selected entry point
82: within the package will then enter the correct emulation code routine.
83:
84: The entry point addresses at the beginning of the package will remain
85: fixed so that a program calling the routines will not have to be
86: re-compiled with every new 68060ILSP release.
87:
88: For example, to use a 64-bit multiply instruction,
89: do a "bsr" or "jsr" to the entry point defined by
90: the 060ILSP entry table. A compiler generated code sequence
91: for unsigned multiply could look like:
92:
93: # mulu.l <ea>,Dh:Dl
94: # mulu.l _multiplier,%d1:%d0
95:
96: subq.l &0x8,%sp # make room for result on stack
97: pea (%sp) # pass: result addr on stack
98: mov.l %d0,-(%sp) # pass: multiplicand on stack
99: mov.l _multiplier,-(%sp) # pass: multiplier on stack
100: bsr.l _060LISP_TOP+0x18 # branch to multiply routine
101: add.l &0xc,%sp # clear arguments from stack
102: mov.l (%sp)+,%d1 # load result[63:32]
103: mov.l (%sp)+,%d0 # load result[31:0]
104:
105: For a divide:
106:
107: # divu.l <ea>,Dr:Dq
108: # divu.l _divisor,%d1:%d0
109:
110: subq.l &0x8,%sp # make room for result on stack
111: pea (%sp) # pass: result addr on stack
112: mov.l %d0,-(%sp) # pass: dividend hi on stack
113: mov.l %d1,-(%sp) # pass: dividend hi on stack
114: mov.l _divisor,-(%sp) # pass: divisor on stack
115: bsr.l _060LISP_TOP+0x08 # branch to divide routine
116: add.l &0xc,%sp # clear arguments from stack
117: mov.l (%sp)+,%d1 # load remainder
118: mov.l (%sp)+,%d0 # load quotient
119:
120: The library routines also return the correct condition code
121: register value. If this is important, then the caller of the library
122: routine must make sure that the value isn't lost while popping
123: other items off of the stack.
124:
125: An example of using the "cmp2" instruction is as follows:
126:
127: # cmp2.l <ea>,Rn
128: # cmp2.l _bounds,%d0
129:
130: pea _bounds # pass ptr to bounds
131: mov.l %d0,-(%sp) # pass Rn
132: bsr.l _060LSP_TOP_+0x48 # branch to "cmp2" routine
133: mov.w %cc,_tmp # save off condition codes
134: addq.l &0x8,%sp # clear arguments from stack
135:
136: Exception reporting:
137: --------------------
138: If the instruction being emulated is a divide and the source
139: operand is a zero, then the library routine, as its last
140: instruction, executes an implemented divide using a zero
141: source operand so that an "Integer Divide-by-Zero" exception
142: will be taken. Although the exception stack frame will not
143: point to the correct instruction, the user will at least be able
144: to record that such an event occurred if desired.
145:
146: 68060ILSP entry points:
147: -----------------------
148: _060ILSP_TOP:
149: 0x000: _060LSP__idivs64_
150: 0x008: _060LSP__idivu64_
151:
152: 0x010: _060LSP__imuls64_
153: 0x018: _060LSP__imulu64_
154:
155: 0x020: _060LSP__cmp2_Ab_
156: 0x028: _060LSP__cmp2_Aw_
157: 0x030: _060LSP__cmp2_Al_
158: 0x038: _060LSP__cmp2_Db_
159: 0x040: _060LSP__cmp2_Dw_
160: 0x048: _060LSP__cmp2_Dl_
CVSweb