ilsp.doc 6.0 KB

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