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