162306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262306a36Sopenharmony_ciMOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP 362306a36Sopenharmony_ciM68000 Hi-Performance Microprocessor Division 462306a36Sopenharmony_ciM68060 Software Package 562306a36Sopenharmony_ciProduction Release P1.00 -- October 10, 1994 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciM68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 862306a36Sopenharmony_ci 962306a36Sopenharmony_ciTHE SOFTWARE is provided on an "AS IS" basis and without warranty. 1062306a36Sopenharmony_ciTo the maximum extent permitted by applicable law, 1162306a36Sopenharmony_ciMOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 1262306a36Sopenharmony_ciINCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 1362306a36Sopenharmony_ciand any warranty against infringement with regard to the SOFTWARE 1462306a36Sopenharmony_ci(INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials. 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ciTo the maximum extent permitted by applicable law, 1762306a36Sopenharmony_ciIN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER 1862306a36Sopenharmony_ci(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, 1962306a36Sopenharmony_ciBUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) 2062306a36Sopenharmony_ciARISING OF THE USE OR INABILITY TO USE THE SOFTWARE. 2162306a36Sopenharmony_ciMotorola assumes no responsibility for the maintenance and support of the SOFTWARE. 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ciYou are hereby granted a copyright license to use, modify, and distribute the SOFTWARE 2462306a36Sopenharmony_ciso long as this entire notice is retained without alteration in any modified and/or 2562306a36Sopenharmony_ciredistributed versions, and that such modified versions are clearly identified as such. 2662306a36Sopenharmony_ciNo licenses are granted by implication, estoppel or otherwise under any patents 2762306a36Sopenharmony_cior trademarks of Motorola, Inc. 2862306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2962306a36Sopenharmony_ci68060 INTEGER SOFTWARE PACKAGE (Library version) 3062306a36Sopenharmony_ci------------------------------------------------- 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ciThe file ilsp.s contains the "Library version" of the 3362306a36Sopenharmony_ci68060 Integer Software Package. Routines included in this 3462306a36Sopenharmony_cimodule can be used to emulate 64-bit divide and multiply, 3562306a36Sopenharmony_ciand the "cmp2" instruction. These instructions are not 3662306a36Sopenharmony_ciimplemented in hardware on the 68060 and normally take 3762306a36Sopenharmony_ciexception vector #61 "Unimplemented Integer Instruction". 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ciBy re-compiling a program that uses these instructions, and 4062306a36Sopenharmony_cimaking subroutine calls in place of the unimplemented 4162306a36Sopenharmony_ciinstructions, a program can avoid the overhead associated with 4262306a36Sopenharmony_citaking the exception. 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ciRelease file format: 4562306a36Sopenharmony_ci-------------------- 4662306a36Sopenharmony_ciThe file ilsp.sa is essentially a hexadecimal image of the 4762306a36Sopenharmony_cirelease package. This is the ONLY format which will be supported. 4862306a36Sopenharmony_ciThe hex image was created by assembling the source code and 4962306a36Sopenharmony_cithen converting the resulting binary output image into an 5062306a36Sopenharmony_ciASCII text file. The hexadecimal numbers are listed 5162306a36Sopenharmony_ciusing the Motorola Assembly Syntax assembler directive "dc.l" 5262306a36Sopenharmony_ci(define constant longword). The file can be converted to other 5362306a36Sopenharmony_ciassembly syntaxes by using any word processor with a global 5462306a36Sopenharmony_cisearch and replace function. 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ciTo assist in assembling and linking this module with other modules, 5762306a36Sopenharmony_cithe installer should add a symbolic label to the top of the file. 5862306a36Sopenharmony_ciThis will allow calling routines to access the entry points 5962306a36Sopenharmony_ciof this package. 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ciThe source code ilsp.s has also been included but only for 6262306a36Sopenharmony_cidocumentation purposes. 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ciRelease file structure: 6562306a36Sopenharmony_ci----------------------- 6662306a36Sopenharmony_ciThe file ilsp.sa contains an "Entry-Point" section and a 6762306a36Sopenharmony_cicode section. The ILSP has no "Call-Out" section. The first section 6862306a36Sopenharmony_ciis the "Entry-Point" section. In order to access a function in the 6962306a36Sopenharmony_cipackage, a program must "bsr" or "jsr" to the location listed 7062306a36Sopenharmony_cibelow in "68060ILSP Entry Points" that corresponds to the desired 7162306a36Sopenharmony_cifunction. A branch instruction located at the selected entry point 7262306a36Sopenharmony_ciwithin the package will then enter the correct emulation code routine. 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ciThe entry point addresses at the beginning of the package will remain 7562306a36Sopenharmony_cifixed so that a program calling the routines will not have to be 7662306a36Sopenharmony_cire-compiled with every new 68060ILSP release. 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ciFor example, to use a 64-bit multiply instruction, 7962306a36Sopenharmony_cido a "bsr" or "jsr" to the entry point defined by 8062306a36Sopenharmony_cithe 060ILSP entry table. A compiler generated code sequence 8162306a36Sopenharmony_cifor unsigned multiply could look like: 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci# mulu.l <ea>,Dh:Dl 8462306a36Sopenharmony_ci# mulu.l _multiplier,%d1:%d0 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci subq.l &0x8,%sp # make room for result on stack 8762306a36Sopenharmony_ci pea (%sp) # pass: result addr on stack 8862306a36Sopenharmony_ci mov.l %d0,-(%sp) # pass: multiplicand on stack 8962306a36Sopenharmony_ci mov.l _multiplier,-(%sp) # pass: multiplier on stack 9062306a36Sopenharmony_ci bsr.l _060LISP_TOP+0x18 # branch to multiply routine 9162306a36Sopenharmony_ci add.l &0xc,%sp # clear arguments from stack 9262306a36Sopenharmony_ci mov.l (%sp)+,%d1 # load result[63:32] 9362306a36Sopenharmony_ci mov.l (%sp)+,%d0 # load result[31:0] 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ciFor a divide: 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ci# divu.l <ea>,Dr:Dq 9862306a36Sopenharmony_ci# divu.l _divisor,%d1:%d0 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci subq.l &0x8,%sp # make room for result on stack 10162306a36Sopenharmony_ci pea (%sp) # pass: result addr on stack 10262306a36Sopenharmony_ci mov.l %d0,-(%sp) # pass: dividend hi on stack 10362306a36Sopenharmony_ci mov.l %d1,-(%sp) # pass: dividend hi on stack 10462306a36Sopenharmony_ci mov.l _divisor,-(%sp) # pass: divisor on stack 10562306a36Sopenharmony_ci bsr.l _060LISP_TOP+0x08 # branch to divide routine 10662306a36Sopenharmony_ci add.l &0xc,%sp # clear arguments from stack 10762306a36Sopenharmony_ci mov.l (%sp)+,%d1 # load remainder 10862306a36Sopenharmony_ci mov.l (%sp)+,%d0 # load quotient 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ciThe library routines also return the correct condition code 11162306a36Sopenharmony_ciregister value. If this is important, then the caller of the library 11262306a36Sopenharmony_ciroutine must make sure that the value isn't lost while popping 11362306a36Sopenharmony_ciother items off of the stack. 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ciAn example of using the "cmp2" instruction is as follows: 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci# cmp2.l <ea>,Rn 11862306a36Sopenharmony_ci# cmp2.l _bounds,%d0 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci pea _bounds # pass ptr to bounds 12162306a36Sopenharmony_ci mov.l %d0,-(%sp) # pass Rn 12262306a36Sopenharmony_ci bsr.l _060LSP_TOP_+0x48 # branch to "cmp2" routine 12362306a36Sopenharmony_ci mov.w %cc,_tmp # save off condition codes 12462306a36Sopenharmony_ci addq.l &0x8,%sp # clear arguments from stack 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ciException reporting: 12762306a36Sopenharmony_ci-------------------- 12862306a36Sopenharmony_ciIf the instruction being emulated is a divide and the source 12962306a36Sopenharmony_cioperand is a zero, then the library routine, as its last 13062306a36Sopenharmony_ciinstruction, executes an implemented divide using a zero 13162306a36Sopenharmony_cisource operand so that an "Integer Divide-by-Zero" exception 13262306a36Sopenharmony_ciwill be taken. Although the exception stack frame will not 13362306a36Sopenharmony_cipoint to the correct instruction, the user will at least be able 13462306a36Sopenharmony_cito record that such an event occurred if desired. 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci68060ILSP entry points: 13762306a36Sopenharmony_ci----------------------- 13862306a36Sopenharmony_ci_060ILSP_TOP: 13962306a36Sopenharmony_ci0x000: _060LSP__idivs64_ 14062306a36Sopenharmony_ci0x008: _060LSP__idivu64_ 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ci0x010: _060LSP__imuls64_ 14362306a36Sopenharmony_ci0x018: _060LSP__imulu64_ 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_ci0x020: _060LSP__cmp2_Ab_ 14662306a36Sopenharmony_ci0x028: _060LSP__cmp2_Aw_ 14762306a36Sopenharmony_ci0x030: _060LSP__cmp2_Al_ 14862306a36Sopenharmony_ci0x038: _060LSP__cmp2_Db_ 14962306a36Sopenharmony_ci0x040: _060LSP__cmp2_Dw_ 15062306a36Sopenharmony_ci0x048: _060LSP__cmp2_Dl_ 151