1*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2*4882a593SmuzhiyunMOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP 3*4882a593SmuzhiyunM68000 Hi-Performance Microprocessor Division 4*4882a593SmuzhiyunM68060 Software Package 5*4882a593SmuzhiyunProduction Release P1.00 -- October 10, 1994 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunM68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunTHE SOFTWARE is provided on an "AS IS" basis and without warranty. 10*4882a593SmuzhiyunTo the maximum extent permitted by applicable law, 11*4882a593SmuzhiyunMOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 12*4882a593SmuzhiyunINCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 13*4882a593Smuzhiyunand any warranty against infringement with regard to the SOFTWARE 14*4882a593Smuzhiyun(INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials. 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunTo the maximum extent permitted by applicable law, 17*4882a593SmuzhiyunIN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER 18*4882a593Smuzhiyun(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, 19*4882a593SmuzhiyunBUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) 20*4882a593SmuzhiyunARISING OF THE USE OR INABILITY TO USE THE SOFTWARE. 21*4882a593SmuzhiyunMotorola assumes no responsibility for the maintenance and support of the SOFTWARE. 22*4882a593Smuzhiyun 23*4882a593SmuzhiyunYou are hereby granted a copyright license to use, modify, and distribute the SOFTWARE 24*4882a593Smuzhiyunso long as this entire notice is retained without alteration in any modified and/or 25*4882a593Smuzhiyunredistributed versions, and that such modified versions are clearly identified as such. 26*4882a593SmuzhiyunNo licenses are granted by implication, estoppel or otherwise under any patents 27*4882a593Smuzhiyunor trademarks of Motorola, Inc. 28*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 29*4882a593Smuzhiyun68060 INTEGER SOFTWARE PACKAGE (Library version) 30*4882a593Smuzhiyun------------------------------------------------- 31*4882a593Smuzhiyun 32*4882a593SmuzhiyunThe file ilsp.s contains the "Library version" of the 33*4882a593Smuzhiyun68060 Integer Software Package. Routines included in this 34*4882a593Smuzhiyunmodule can be used to emulate 64-bit divide and multiply, 35*4882a593Smuzhiyunand the "cmp2" instruction. These instructions are not 36*4882a593Smuzhiyunimplemented in hardware on the 68060 and normally take 37*4882a593Smuzhiyunexception vector #61 "Unimplemented Integer Instruction". 38*4882a593Smuzhiyun 39*4882a593SmuzhiyunBy re-compiling a program that uses these instructions, and 40*4882a593Smuzhiyunmaking subroutine calls in place of the unimplemented 41*4882a593Smuzhiyuninstructions, a program can avoid the overhead associated with 42*4882a593Smuzhiyuntaking the exception. 43*4882a593Smuzhiyun 44*4882a593SmuzhiyunRelease file format: 45*4882a593Smuzhiyun-------------------- 46*4882a593SmuzhiyunThe file ilsp.sa is essentially a hexadecimal image of the 47*4882a593Smuzhiyunrelease package. This is the ONLY format which will be supported. 48*4882a593SmuzhiyunThe hex image was created by assembling the source code and 49*4882a593Smuzhiyunthen converting the resulting binary output image into an 50*4882a593SmuzhiyunASCII text file. The hexadecimal numbers are listed 51*4882a593Smuzhiyunusing the Motorola Assembly Syntax assembler directive "dc.l" 52*4882a593Smuzhiyun(define constant longword). The file can be converted to other 53*4882a593Smuzhiyunassembly syntaxes by using any word processor with a global 54*4882a593Smuzhiyunsearch and replace function. 55*4882a593Smuzhiyun 56*4882a593SmuzhiyunTo assist in assembling and linking this module with other modules, 57*4882a593Smuzhiyunthe installer should add a symbolic label to the top of the file. 58*4882a593SmuzhiyunThis will allow calling routines to access the entry points 59*4882a593Smuzhiyunof this package. 60*4882a593Smuzhiyun 61*4882a593SmuzhiyunThe source code ilsp.s has also been included but only for 62*4882a593Smuzhiyundocumentation purposes. 63*4882a593Smuzhiyun 64*4882a593SmuzhiyunRelease file structure: 65*4882a593Smuzhiyun----------------------- 66*4882a593SmuzhiyunThe file ilsp.sa contains an "Entry-Point" section and a 67*4882a593Smuzhiyuncode section. The ILSP has no "Call-Out" section. The first section 68*4882a593Smuzhiyunis the "Entry-Point" section. In order to access a function in the 69*4882a593Smuzhiyunpackage, a program must "bsr" or "jsr" to the location listed 70*4882a593Smuzhiyunbelow in "68060ILSP Entry Points" that corresponds to the desired 71*4882a593Smuzhiyunfunction. A branch instruction located at the selected entry point 72*4882a593Smuzhiyunwithin the package will then enter the correct emulation code routine. 73*4882a593Smuzhiyun 74*4882a593SmuzhiyunThe entry point addresses at the beginning of the package will remain 75*4882a593Smuzhiyunfixed so that a program calling the routines will not have to be 76*4882a593Smuzhiyunre-compiled with every new 68060ILSP release. 77*4882a593Smuzhiyun 78*4882a593SmuzhiyunFor example, to use a 64-bit multiply instruction, 79*4882a593Smuzhiyundo a "bsr" or "jsr" to the entry point defined by 80*4882a593Smuzhiyunthe 060ILSP entry table. A compiler generated code sequence 81*4882a593Smuzhiyunfor unsigned multiply could look like: 82*4882a593Smuzhiyun 83*4882a593Smuzhiyun# mulu.l <ea>,Dh:Dl 84*4882a593Smuzhiyun# mulu.l _multiplier,%d1:%d0 85*4882a593Smuzhiyun 86*4882a593Smuzhiyun subq.l &0x8,%sp # make room for result on stack 87*4882a593Smuzhiyun pea (%sp) # pass: result addr on stack 88*4882a593Smuzhiyun mov.l %d0,-(%sp) # pass: multiplicand on stack 89*4882a593Smuzhiyun mov.l _multiplier,-(%sp) # pass: multiplier on stack 90*4882a593Smuzhiyun bsr.l _060LISP_TOP+0x18 # branch to multiply routine 91*4882a593Smuzhiyun add.l &0xc,%sp # clear arguments from stack 92*4882a593Smuzhiyun mov.l (%sp)+,%d1 # load result[63:32] 93*4882a593Smuzhiyun mov.l (%sp)+,%d0 # load result[31:0] 94*4882a593Smuzhiyun 95*4882a593SmuzhiyunFor a divide: 96*4882a593Smuzhiyun 97*4882a593Smuzhiyun# divu.l <ea>,Dr:Dq 98*4882a593Smuzhiyun# divu.l _divisor,%d1:%d0 99*4882a593Smuzhiyun 100*4882a593Smuzhiyun subq.l &0x8,%sp # make room for result on stack 101*4882a593Smuzhiyun pea (%sp) # pass: result addr on stack 102*4882a593Smuzhiyun mov.l %d0,-(%sp) # pass: dividend hi on stack 103*4882a593Smuzhiyun mov.l %d1,-(%sp) # pass: dividend hi on stack 104*4882a593Smuzhiyun mov.l _divisor,-(%sp) # pass: divisor on stack 105*4882a593Smuzhiyun bsr.l _060LISP_TOP+0x08 # branch to divide routine 106*4882a593Smuzhiyun add.l &0xc,%sp # clear arguments from stack 107*4882a593Smuzhiyun mov.l (%sp)+,%d1 # load remainder 108*4882a593Smuzhiyun mov.l (%sp)+,%d0 # load quotient 109*4882a593Smuzhiyun 110*4882a593SmuzhiyunThe library routines also return the correct condition code 111*4882a593Smuzhiyunregister value. If this is important, then the caller of the library 112*4882a593Smuzhiyunroutine must make sure that the value isn't lost while popping 113*4882a593Smuzhiyunother items off of the stack. 114*4882a593Smuzhiyun 115*4882a593SmuzhiyunAn example of using the "cmp2" instruction is as follows: 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun# cmp2.l <ea>,Rn 118*4882a593Smuzhiyun# cmp2.l _bounds,%d0 119*4882a593Smuzhiyun 120*4882a593Smuzhiyun pea _bounds # pass ptr to bounds 121*4882a593Smuzhiyun mov.l %d0,-(%sp) # pass Rn 122*4882a593Smuzhiyun bsr.l _060LSP_TOP_+0x48 # branch to "cmp2" routine 123*4882a593Smuzhiyun mov.w %cc,_tmp # save off condition codes 124*4882a593Smuzhiyun addq.l &0x8,%sp # clear arguments from stack 125*4882a593Smuzhiyun 126*4882a593SmuzhiyunException reporting: 127*4882a593Smuzhiyun-------------------- 128*4882a593SmuzhiyunIf the instruction being emulated is a divide and the source 129*4882a593Smuzhiyunoperand is a zero, then the library routine, as its last 130*4882a593Smuzhiyuninstruction, executes an implemented divide using a zero 131*4882a593Smuzhiyunsource operand so that an "Integer Divide-by-Zero" exception 132*4882a593Smuzhiyunwill be taken. Although the exception stack frame will not 133*4882a593Smuzhiyunpoint to the correct instruction, the user will at least be able 134*4882a593Smuzhiyunto record that such an event occurred if desired. 135*4882a593Smuzhiyun 136*4882a593Smuzhiyun68060ILSP entry points: 137*4882a593Smuzhiyun----------------------- 138*4882a593Smuzhiyun_060ILSP_TOP: 139*4882a593Smuzhiyun0x000: _060LSP__idivs64_ 140*4882a593Smuzhiyun0x008: _060LSP__idivu64_ 141*4882a593Smuzhiyun 142*4882a593Smuzhiyun0x010: _060LSP__imuls64_ 143*4882a593Smuzhiyun0x018: _060LSP__imulu64_ 144*4882a593Smuzhiyun 145*4882a593Smuzhiyun0x020: _060LSP__cmp2_Ab_ 146*4882a593Smuzhiyun0x028: _060LSP__cmp2_Aw_ 147*4882a593Smuzhiyun0x030: _060LSP__cmp2_Al_ 148*4882a593Smuzhiyun0x038: _060LSP__cmp2_Db_ 149*4882a593Smuzhiyun0x040: _060LSP__cmp2_Dw_ 150*4882a593Smuzhiyun0x048: _060LSP__cmp2_Dl_ 151