18c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 28c2ecf20Sopenharmony_ciMOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP 38c2ecf20Sopenharmony_ciM68000 Hi-Performance Microprocessor Division 48c2ecf20Sopenharmony_ciM68060 Software Package 58c2ecf20Sopenharmony_ciProduction Release P1.00 -- October 10, 1994 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ciM68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ciTHE SOFTWARE is provided on an "AS IS" basis and without warranty. 108c2ecf20Sopenharmony_ciTo the maximum extent permitted by applicable law, 118c2ecf20Sopenharmony_ciMOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 128c2ecf20Sopenharmony_ciINCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 138c2ecf20Sopenharmony_ciand any warranty against infringement with regard to the SOFTWARE 148c2ecf20Sopenharmony_ci(INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials. 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciTo the maximum extent permitted by applicable law, 178c2ecf20Sopenharmony_ciIN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER 188c2ecf20Sopenharmony_ci(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, 198c2ecf20Sopenharmony_ciBUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) 208c2ecf20Sopenharmony_ciARISING OF THE USE OR INABILITY TO USE THE SOFTWARE. 218c2ecf20Sopenharmony_ciMotorola assumes no responsibility for the maintenance and support of the SOFTWARE. 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ciYou are hereby granted a copyright license to use, modify, and distribute the SOFTWARE 248c2ecf20Sopenharmony_ciso long as this entire notice is retained without alteration in any modified and/or 258c2ecf20Sopenharmony_ciredistributed versions, and that such modified versions are clearly identified as such. 268c2ecf20Sopenharmony_ciNo licenses are granted by implication, estoppel or otherwise under any patents 278c2ecf20Sopenharmony_cior trademarks of Motorola, Inc. 288c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298c2ecf20Sopenharmony_ci68060 INTEGER SOFTWARE PACKAGE (Library version) 308c2ecf20Sopenharmony_ci------------------------------------------------- 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ciThe file ilsp.s contains the "Library version" of the 338c2ecf20Sopenharmony_ci68060 Integer Software Package. Routines included in this 348c2ecf20Sopenharmony_cimodule can be used to emulate 64-bit divide and multiply, 358c2ecf20Sopenharmony_ciand the "cmp2" instruction. These instructions are not 368c2ecf20Sopenharmony_ciimplemented in hardware on the 68060 and normally take 378c2ecf20Sopenharmony_ciexception vector #61 "Unimplemented Integer Instruction". 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ciBy re-compiling a program that uses these instructions, and 408c2ecf20Sopenharmony_cimaking subroutine calls in place of the unimplemented 418c2ecf20Sopenharmony_ciinstructions, a program can avoid the overhead associated with 428c2ecf20Sopenharmony_citaking the exception. 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciRelease file format: 458c2ecf20Sopenharmony_ci-------------------- 468c2ecf20Sopenharmony_ciThe file ilsp.sa is essentially a hexadecimal image of the 478c2ecf20Sopenharmony_cirelease package. This is the ONLY format which will be supported. 488c2ecf20Sopenharmony_ciThe hex image was created by assembling the source code and 498c2ecf20Sopenharmony_cithen converting the resulting binary output image into an 508c2ecf20Sopenharmony_ciASCII text file. The hexadecimal numbers are listed 518c2ecf20Sopenharmony_ciusing the Motorola Assembly Syntax assembler directive "dc.l" 528c2ecf20Sopenharmony_ci(define constant longword). The file can be converted to other 538c2ecf20Sopenharmony_ciassembly syntaxes by using any word processor with a global 548c2ecf20Sopenharmony_cisearch and replace function. 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ciTo assist in assembling and linking this module with other modules, 578c2ecf20Sopenharmony_cithe installer should add a symbolic label to the top of the file. 588c2ecf20Sopenharmony_ciThis will allow calling routines to access the entry points 598c2ecf20Sopenharmony_ciof this package. 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ciThe source code ilsp.s has also been included but only for 628c2ecf20Sopenharmony_cidocumentation purposes. 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ciRelease file structure: 658c2ecf20Sopenharmony_ci----------------------- 668c2ecf20Sopenharmony_ciThe file ilsp.sa contains an "Entry-Point" section and a 678c2ecf20Sopenharmony_cicode section. The ILSP has no "Call-Out" section. The first section 688c2ecf20Sopenharmony_ciis the "Entry-Point" section. In order to access a function in the 698c2ecf20Sopenharmony_cipackage, a program must "bsr" or "jsr" to the location listed 708c2ecf20Sopenharmony_cibelow in "68060ILSP Entry Points" that corresponds to the desired 718c2ecf20Sopenharmony_cifunction. A branch instruction located at the selected entry point 728c2ecf20Sopenharmony_ciwithin the package will then enter the correct emulation code routine. 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ciThe entry point addresses at the beginning of the package will remain 758c2ecf20Sopenharmony_cifixed so that a program calling the routines will not have to be 768c2ecf20Sopenharmony_cire-compiled with every new 68060ILSP release. 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ciFor example, to use a 64-bit multiply instruction, 798c2ecf20Sopenharmony_cido a "bsr" or "jsr" to the entry point defined by 808c2ecf20Sopenharmony_cithe 060ILSP entry table. A compiler generated code sequence 818c2ecf20Sopenharmony_cifor unsigned multiply could look like: 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci# mulu.l <ea>,Dh:Dl 848c2ecf20Sopenharmony_ci# mulu.l _multiplier,%d1:%d0 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci subq.l &0x8,%sp # make room for result on stack 878c2ecf20Sopenharmony_ci pea (%sp) # pass: result addr on stack 888c2ecf20Sopenharmony_ci mov.l %d0,-(%sp) # pass: multiplicand on stack 898c2ecf20Sopenharmony_ci mov.l _multiplier,-(%sp) # pass: multiplier on stack 908c2ecf20Sopenharmony_ci bsr.l _060LISP_TOP+0x18 # branch to multiply routine 918c2ecf20Sopenharmony_ci add.l &0xc,%sp # clear arguments from stack 928c2ecf20Sopenharmony_ci mov.l (%sp)+,%d1 # load result[63:32] 938c2ecf20Sopenharmony_ci mov.l (%sp)+,%d0 # load result[31:0] 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ciFor a divide: 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci# divu.l <ea>,Dr:Dq 988c2ecf20Sopenharmony_ci# divu.l _divisor,%d1:%d0 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci subq.l &0x8,%sp # make room for result on stack 1018c2ecf20Sopenharmony_ci pea (%sp) # pass: result addr on stack 1028c2ecf20Sopenharmony_ci mov.l %d0,-(%sp) # pass: dividend hi on stack 1038c2ecf20Sopenharmony_ci mov.l %d1,-(%sp) # pass: dividend hi on stack 1048c2ecf20Sopenharmony_ci mov.l _divisor,-(%sp) # pass: divisor on stack 1058c2ecf20Sopenharmony_ci bsr.l _060LISP_TOP+0x08 # branch to divide routine 1068c2ecf20Sopenharmony_ci add.l &0xc,%sp # clear arguments from stack 1078c2ecf20Sopenharmony_ci mov.l (%sp)+,%d1 # load remainder 1088c2ecf20Sopenharmony_ci mov.l (%sp)+,%d0 # load quotient 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ciThe library routines also return the correct condition code 1118c2ecf20Sopenharmony_ciregister value. If this is important, then the caller of the library 1128c2ecf20Sopenharmony_ciroutine must make sure that the value isn't lost while popping 1138c2ecf20Sopenharmony_ciother items off of the stack. 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ciAn example of using the "cmp2" instruction is as follows: 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci# cmp2.l <ea>,Rn 1188c2ecf20Sopenharmony_ci# cmp2.l _bounds,%d0 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci pea _bounds # pass ptr to bounds 1218c2ecf20Sopenharmony_ci mov.l %d0,-(%sp) # pass Rn 1228c2ecf20Sopenharmony_ci bsr.l _060LSP_TOP_+0x48 # branch to "cmp2" routine 1238c2ecf20Sopenharmony_ci mov.w %cc,_tmp # save off condition codes 1248c2ecf20Sopenharmony_ci addq.l &0x8,%sp # clear arguments from stack 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ciException reporting: 1278c2ecf20Sopenharmony_ci-------------------- 1288c2ecf20Sopenharmony_ciIf the instruction being emulated is a divide and the source 1298c2ecf20Sopenharmony_cioperand is a zero, then the library routine, as its last 1308c2ecf20Sopenharmony_ciinstruction, executes an implemented divide using a zero 1318c2ecf20Sopenharmony_cisource operand so that an "Integer Divide-by-Zero" exception 1328c2ecf20Sopenharmony_ciwill be taken. Although the exception stack frame will not 1338c2ecf20Sopenharmony_cipoint to the correct instruction, the user will at least be able 1348c2ecf20Sopenharmony_cito record that such an event occurred if desired. 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci68060ILSP entry points: 1378c2ecf20Sopenharmony_ci----------------------- 1388c2ecf20Sopenharmony_ci_060ILSP_TOP: 1398c2ecf20Sopenharmony_ci0x000: _060LSP__idivs64_ 1408c2ecf20Sopenharmony_ci0x008: _060LSP__idivu64_ 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci0x010: _060LSP__imuls64_ 1438c2ecf20Sopenharmony_ci0x018: _060LSP__imulu64_ 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci0x020: _060LSP__cmp2_Ab_ 1468c2ecf20Sopenharmony_ci0x028: _060LSP__cmp2_Aw_ 1478c2ecf20Sopenharmony_ci0x030: _060LSP__cmp2_Al_ 1488c2ecf20Sopenharmony_ci0x038: _060LSP__cmp2_Db_ 1498c2ecf20Sopenharmony_ci0x040: _060LSP__cmp2_Dw_ 1508c2ecf20Sopenharmony_ci0x048: _060LSP__cmp2_Dl_ 151