iskeleton.S 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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. |
  7. |M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
  8. |
  9. |THE SOFTWARE is provided on an "AS IS" basis and without warranty.
  10. |To the maximum extent permitted by applicable law,
  11. |MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
  12. |INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
  13. |and any warranty against infringement with regard to the SOFTWARE
  14. |(INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
  15. |
  16. |To the maximum extent permitted by applicable law,
  17. |IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
  18. |(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
  19. |BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
  20. |ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
  21. |Motorola assumes no responsibility for the maintenance and support of the SOFTWARE.
  22. |
  23. |You are hereby granted a copyright license to use, modify, and distribute the SOFTWARE
  24. |so long as this entire notice is retained without alteration in any modified and/or
  25. |redistributed versions, and that such modified versions are clearly identified as such.
  26. |No licenses are granted by implication, estoppel or otherwise under any patents
  27. |or trademarks of Motorola, Inc.
  28. |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  29. | iskeleton.s
  30. |
  31. | This file contains:
  32. | (1) example "Call-out"s
  33. | (2) example package entry code
  34. | (3) example "Call-out" table
  35. |
  36. #include <linux/linkage.h>
  37. #include <asm/entry.h>
  38. #include <asm/asm-offsets.h>
  39. |################################
  40. | (1) EXAMPLE CALL-OUTS #
  41. | #
  42. | _060_isp_done() #
  43. | _060_real_chk() #
  44. | _060_real_divbyzero() #
  45. | #
  46. | _060_real_cas() #
  47. | _060_real_cas2() #
  48. | _060_real_lock_page() #
  49. | _060_real_unlock_page() #
  50. |################################
  51. |
  52. | _060_isp_done():
  53. |
  54. | This is and example main exit point for the Unimplemented Integer
  55. | Instruction exception handler. For a normal exit, the
  56. | _isp_unimp() branches to here so that the operating system
  57. | can do any clean-up desired. The stack frame is the
  58. | Unimplemented Integer Instruction stack frame with
  59. | the PC pointing to the instruction following the instruction
  60. | just emulated.
  61. | To simply continue execution at the next instruction, just
  62. | do an "rte".
  63. |
  64. | Linux/68k: If returning to user space, check for needed reselections.
  65. .global _060_isp_done
  66. _060_isp_done:
  67. btst #0x5,%sp@ | supervisor bit set in saved SR?
  68. beq .Lnotkern
  69. rte
  70. .Lnotkern:
  71. SAVE_ALL_INT
  72. GET_CURRENT(%d0)
  73. | deliver signals, reschedule etc..
  74. jra ret_from_exception
  75. |
  76. | _060_real_chk():
  77. |
  78. | This is an alternate exit point for the Unimplemented Integer
  79. | Instruction exception handler. If the instruction was a "chk2"
  80. | and the operand was out of bounds, then _isp_unimp() creates
  81. | a CHK exception stack frame from the Unimplemented Integer Instrcution
  82. | stack frame and branches to this routine.
  83. |
  84. | Linux/68k: commented out test for tracing
  85. .global _060_real_chk
  86. _060_real_chk:
  87. | tst.b (%sp) | is tracing enabled?
  88. | bpls real_chk_end | no
  89. |
  90. | CHK FRAME TRACE FRAME
  91. | ***************** *****************
  92. | * Current PC * * Current PC *
  93. | ***************** *****************
  94. | * 0x2 * 0x018 * * 0x2 * 0x024 *
  95. | ***************** *****************
  96. | * Next * * Next *
  97. | * PC * * PC *
  98. | ***************** *****************
  99. | * SR * * SR *
  100. | ***************** *****************
  101. |
  102. | move.b #0x24,0x7(%sp) | set trace vecno
  103. | bral _060_real_trace
  104. real_chk_end:
  105. bral trap | jump to trap handler
  106. |
  107. | _060_real_divbyzero:
  108. |
  109. | This is an alternate exit point for the Unimplemented Integer
  110. | Instruction exception handler isp_unimp(). If the instruction is a 64-bit
  111. | integer divide where the source operand is a zero, then the _isp_unimp()
  112. | creates a Divide-by-zero exception stack frame from the Unimplemented
  113. | Integer Instruction stack frame and branches to this routine.
  114. |
  115. | Remember that a trace exception may be pending. The code below performs
  116. | no action associated with the "chk" exception. If tracing is enabled,
  117. | then it create a Trace exception stack frame from the "chk" exception
  118. | stack frame and branches to the _real_trace() entry point.
  119. |
  120. | Linux/68k: commented out test for tracing
  121. .global _060_real_divbyzero
  122. _060_real_divbyzero:
  123. | tst.b (%sp) | is tracing enabled?
  124. | bpls real_divbyzero_end | no
  125. |
  126. | DIVBYZERO FRAME TRACE FRAME
  127. | ***************** *****************
  128. | * Current PC * * Current PC *
  129. | ***************** *****************
  130. | * 0x2 * 0x014 * * 0x2 * 0x024 *
  131. | ***************** *****************
  132. | * Next * * Next *
  133. | * PC * * PC *
  134. | ***************** *****************
  135. | * SR * * SR *
  136. | ***************** *****************
  137. |
  138. | move.b #0x24,0x7(%sp) | set trace vecno
  139. | bral _060_real_trace
  140. real_divbyzero_end:
  141. bral trap | jump to trap handler
  142. |##########################
  143. |
  144. | _060_real_cas():
  145. |
  146. | Entry point for the selected cas emulation code implementation.
  147. | If the implementation provided by the 68060ISP is sufficient,
  148. | then this routine simply re-enters the package through _isp_cas.
  149. |
  150. .global _060_real_cas
  151. _060_real_cas:
  152. bral _I_CALL_TOP+0x80+0x08
  153. |
  154. | _060_real_cas2():
  155. |
  156. | Entry point for the selected cas2 emulation code implementation.
  157. | If the implementation provided by the 68060ISP is sufficient,
  158. | then this routine simply re-enters the package through _isp_cas2.
  159. |
  160. .global _060_real_cas2
  161. _060_real_cas2:
  162. bral _I_CALL_TOP+0x80+0x10
  163. |
  164. | _060_lock_page():
  165. |
  166. | Entry point for the operating system`s routine to "lock" a page
  167. | from being paged out. This routine is needed by the cas/cas2
  168. | algorithms so that no page faults occur within the "core" code
  169. | region. Note: the routine must lock two pages if the operand
  170. | spans two pages.
  171. | NOTE: THE ROUTINE SHOULD RETURN AN FSLW VALUE IN D0 ON FAILURE
  172. | SO THAT THE 060SP CAN CREATE A PROPER ACCESS ERROR FRAME.
  173. | Arguments:
  174. | a0 = operand address
  175. | d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user
  176. | d1 = `xxxxxxff -> longword; `xxxxxx00 -> word
  177. | Expected outputs:
  178. | d0 = 0 -> success; non-zero -> failure
  179. |
  180. | Linux/m68k: Make sure the page is properly paged in, so we use
  181. | plpaw and handle any exception here. The kernel must not be
  182. | preempted until _060_unlock_page(), so that the page stays mapped.
  183. |
  184. .global _060_real_lock_page
  185. _060_real_lock_page:
  186. move.l %d2,-(%sp)
  187. | load sfc/dfc
  188. tst.b %d0
  189. jne 1f
  190. moveq #1,%d0
  191. jra 2f
  192. 1: moveq #5,%d0
  193. 2: movec.l %dfc,%d2
  194. movec.l %d0,%dfc
  195. movec.l %d0,%sfc
  196. clr.l %d0
  197. | prefetch address
  198. .chip 68060
  199. move.l %a0,%a1
  200. 1: plpaw (%a1)
  201. addq.w #1,%a0
  202. tst.b %d1
  203. jeq 2f
  204. addq.w #2,%a0
  205. 2: plpaw (%a0)
  206. 3: .chip 68k
  207. | restore sfc/dfc
  208. movec.l %d2,%dfc
  209. movec.l %d2,%sfc
  210. move.l (%sp)+,%d2
  211. rts
  212. .section __ex_table,"a"
  213. .align 4
  214. .long 1b,11f
  215. .long 2b,21f
  216. .previous
  217. .section .fixup,"ax"
  218. .even
  219. 11: move.l #0x020003c0,%d0
  220. or.l %d2,%d0
  221. swap %d0
  222. jra 3b
  223. 21: move.l #0x02000bc0,%d0
  224. or.l %d2,%d0
  225. swap %d0
  226. jra 3b
  227. .previous
  228. |
  229. | _060_unlock_page():
  230. |
  231. | Entry point for the operating system`s routine to "unlock" a
  232. | page that has been "locked" previously with _real_lock_page.
  233. | Note: the routine must unlock two pages if the operand spans
  234. | two pages.
  235. | Arguments:
  236. | a0 = operand address
  237. | d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user
  238. | d1 = `xxxxxxff -> longword; `xxxxxx00 -> word
  239. |
  240. | Linux/m68k: perhaps reenable preemption here...
  241. .global _060_real_unlock_page
  242. _060_real_unlock_page:
  243. clr.l %d0
  244. rts
  245. |###########################################################################
  246. |#################################
  247. | (2) EXAMPLE PACKAGE ENTRY CODE #
  248. |#################################
  249. .global _060_isp_unimp
  250. _060_isp_unimp:
  251. bral _I_CALL_TOP+0x80+0x00
  252. .global _060_isp_cas
  253. _060_isp_cas:
  254. bral _I_CALL_TOP+0x80+0x08
  255. .global _060_isp_cas2
  256. _060_isp_cas2:
  257. bral _I_CALL_TOP+0x80+0x10
  258. .global _060_isp_cas_finish
  259. _060_isp_cas_finish:
  260. bra.l _I_CALL_TOP+0x80+0x18
  261. .global _060_isp_cas2_finish
  262. _060_isp_cas2_finish:
  263. bral _I_CALL_TOP+0x80+0x20
  264. .global _060_isp_cas_inrange
  265. _060_isp_cas_inrange:
  266. bral _I_CALL_TOP+0x80+0x28
  267. .global _060_isp_cas_terminate
  268. _060_isp_cas_terminate:
  269. bral _I_CALL_TOP+0x80+0x30
  270. .global _060_isp_cas_restart
  271. _060_isp_cas_restart:
  272. bral _I_CALL_TOP+0x80+0x38
  273. |###########################################################################
  274. |###############################
  275. | (3) EXAMPLE CALL-OUT SECTION #
  276. |###############################
  277. | The size of this section MUST be 128 bytes!!!
  278. _I_CALL_TOP:
  279. .long _060_real_chk - _I_CALL_TOP
  280. .long _060_real_divbyzero - _I_CALL_TOP
  281. .long _060_real_trace - _I_CALL_TOP
  282. .long _060_real_access - _I_CALL_TOP
  283. .long _060_isp_done - _I_CALL_TOP
  284. .long _060_real_cas - _I_CALL_TOP
  285. .long _060_real_cas2 - _I_CALL_TOP
  286. .long _060_real_lock_page - _I_CALL_TOP
  287. .long _060_real_unlock_page - _I_CALL_TOP
  288. .long 0x00000000, 0x00000000, 0x00000000, 0x00000000
  289. .long 0x00000000, 0x00000000, 0x00000000
  290. .long _060_imem_read - _I_CALL_TOP
  291. .long _060_dmem_read - _I_CALL_TOP
  292. .long _060_dmem_write - _I_CALL_TOP
  293. .long _060_imem_read_word - _I_CALL_TOP
  294. .long _060_imem_read_long - _I_CALL_TOP
  295. .long _060_dmem_read_byte - _I_CALL_TOP
  296. .long _060_dmem_read_word - _I_CALL_TOP
  297. .long _060_dmem_read_long - _I_CALL_TOP
  298. .long _060_dmem_write_byte - _I_CALL_TOP
  299. .long _060_dmem_write_word - _I_CALL_TOP
  300. .long _060_dmem_write_long - _I_CALL_TOP
  301. .long 0x00000000
  302. .long 0x00000000, 0x00000000, 0x00000000, 0x00000000
  303. |###########################################################################
  304. | 060 INTEGER KERNEL PACKAGE MUST GO HERE!!!
  305. #include "isp.sa"