iskeleton.S 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  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/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. tstb %curptr@(TASK_NEEDRESCHED)
  74. jne ret_from_exception | deliver signals,
  75. | reschedule etc..
  76. RESTORE_ALL
  77. |
  78. | _060_real_chk():
  79. |
  80. | This is an alternate exit point for the Unimplemented Integer
  81. | Instruction exception handler. If the instruction was a "chk2"
  82. | and the operand was out of bounds, then _isp_unimp() creates
  83. | a CHK exception stack frame from the Unimplemented Integer Instrcution
  84. | stack frame and branches to this routine.
  85. |
  86. | Linux/68k: commented out test for tracing
  87. .global _060_real_chk
  88. _060_real_chk:
  89. | tst.b (%sp) | is tracing enabled?
  90. | bpls real_chk_end | no
  91. |
  92. | CHK FRAME TRACE FRAME
  93. | ***************** *****************
  94. | * Current PC * * Current PC *
  95. | ***************** *****************
  96. | * 0x2 * 0x018 * * 0x2 * 0x024 *
  97. | ***************** *****************
  98. | * Next * * Next *
  99. | * PC * * PC *
  100. | ***************** *****************
  101. | * SR * * SR *
  102. | ***************** *****************
  103. |
  104. | move.b #0x24,0x7(%sp) | set trace vecno
  105. | bral _060_real_trace
  106. real_chk_end:
  107. bral trap | jump to trap handler
  108. |
  109. | _060_real_divbyzero:
  110. |
  111. | This is an alternate exit point for the Unimplemented Integer
  112. | Instruction exception handler isp_unimp(). If the instruction is a 64-bit
  113. | integer divide where the source operand is a zero, then the _isp_unimp()
  114. | creates a Divide-by-zero exception stack frame from the Unimplemented
  115. | Integer Instruction stack frame and branches to this routine.
  116. |
  117. | Remember that a trace exception may be pending. The code below performs
  118. | no action associated with the "chk" exception. If tracing is enabled,
  119. | then it create a Trace exception stack frame from the "chk" exception
  120. | stack frame and branches to the _real_trace() entry point.
  121. |
  122. | Linux/68k: commented out test for tracing
  123. .global _060_real_divbyzero
  124. _060_real_divbyzero:
  125. | tst.b (%sp) | is tracing enabled?
  126. | bpls real_divbyzero_end | no
  127. |
  128. | DIVBYZERO FRAME TRACE FRAME
  129. | ***************** *****************
  130. | * Current PC * * Current PC *
  131. | ***************** *****************
  132. | * 0x2 * 0x014 * * 0x2 * 0x024 *
  133. | ***************** *****************
  134. | * Next * * Next *
  135. | * PC * * PC *
  136. | ***************** *****************
  137. | * SR * * SR *
  138. | ***************** *****************
  139. |
  140. | move.b #0x24,0x7(%sp) | set trace vecno
  141. | bral _060_real_trace
  142. real_divbyzero_end:
  143. bral trap | jump to trap handler
  144. |##########################
  145. |
  146. | _060_real_cas():
  147. |
  148. | Entry point for the selected cas emulation code implementation.
  149. | If the implementation provided by the 68060ISP is sufficient,
  150. | then this routine simply re-enters the package through _isp_cas.
  151. |
  152. .global _060_real_cas
  153. _060_real_cas:
  154. bral _I_CALL_TOP+0x80+0x08
  155. |
  156. | _060_real_cas2():
  157. |
  158. | Entry point for the selected cas2 emulation code implementation.
  159. | If the implementation provided by the 68060ISP is sufficient,
  160. | then this routine simply re-enters the package through _isp_cas2.
  161. |
  162. .global _060_real_cas2
  163. _060_real_cas2:
  164. bral _I_CALL_TOP+0x80+0x10
  165. |
  166. | _060_lock_page():
  167. |
  168. | Entry point for the operating system`s routine to "lock" a page
  169. | from being paged out. This routine is needed by the cas/cas2
  170. | algorithms so that no page faults occur within the "core" code
  171. | region. Note: the routine must lock two pages if the operand
  172. | spans two pages.
  173. | NOTE: THE ROUTINE SHOULD RETURN AN FSLW VALUE IN D0 ON FAILURE
  174. | SO THAT THE 060SP CAN CREATE A PROPER ACCESS ERROR FRAME.
  175. | Arguments:
  176. | a0 = operand address
  177. | d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user
  178. | d1 = `xxxxxxff -> longword; `xxxxxx00 -> word
  179. | Expected outputs:
  180. | d0 = 0 -> success; non-zero -> failure
  181. |
  182. | Linux/m68k: Make sure the page is properly paged in, so we use
  183. | plpaw and handle any exception here. The kernel must not be
  184. | preempted until _060_unlock_page(), so that the page stays mapped.
  185. |
  186. .global _060_real_lock_page
  187. _060_real_lock_page:
  188. move.l %d2,-(%sp)
  189. | load sfc/dfc
  190. tst.b %d0
  191. jne 1f
  192. moveq #1,%d0
  193. jra 2f
  194. 1: moveq #5,%d0
  195. 2: movec.l %dfc,%d2
  196. movec.l %d0,%dfc
  197. movec.l %d0,%sfc
  198. clr.l %d0
  199. | prefetch address
  200. .chip 68060
  201. move.l %a0,%a1
  202. 1: plpaw (%a1)
  203. addq.w #1,%a0
  204. tst.b %d1
  205. jeq 2f
  206. addq.w #2,%a0
  207. 2: plpaw (%a0)
  208. 3: .chip 68k
  209. | restore sfc/dfc
  210. movec.l %d2,%dfc
  211. movec.l %d2,%sfc
  212. move.l (%sp)+,%d2
  213. rts
  214. .section __ex_table,"a"
  215. .align 4
  216. .long 1b,11f
  217. .long 2b,21f
  218. .previous
  219. .section .fixup,"ax"
  220. .even
  221. 11: move.l #0x020003c0,%d0
  222. or.l %d2,%d0
  223. swap %d0
  224. jra 3b
  225. 21: move.l #0x02000bc0,%d0
  226. or.l %d2,%d0
  227. swap %d0
  228. jra 3b
  229. .previous
  230. |
  231. | _060_unlock_page():
  232. |
  233. | Entry point for the operating system`s routine to "unlock" a
  234. | page that has been "locked" previously with _real_lock_page.
  235. | Note: the routine must unlock two pages if the operand spans
  236. | two pages.
  237. | Arguments:
  238. | a0 = operand address
  239. | d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user
  240. | d1 = `xxxxxxff -> longword; `xxxxxx00 -> word
  241. |
  242. | Linux/m68k: perhaps reenable preemption here...
  243. .global _060_real_unlock_page
  244. _060_real_unlock_page:
  245. clr.l %d0
  246. rts
  247. |###########################################################################
  248. |#################################
  249. | (2) EXAMPLE PACKAGE ENTRY CODE #
  250. |#################################
  251. .global _060_isp_unimp
  252. _060_isp_unimp:
  253. bral _I_CALL_TOP+0x80+0x00
  254. .global _060_isp_cas
  255. _060_isp_cas:
  256. bral _I_CALL_TOP+0x80+0x08
  257. .global _060_isp_cas2
  258. _060_isp_cas2:
  259. bral _I_CALL_TOP+0x80+0x10
  260. .global _060_isp_cas_finish
  261. _060_isp_cas_finish:
  262. bra.l _I_CALL_TOP+0x80+0x18
  263. .global _060_isp_cas2_finish
  264. _060_isp_cas2_finish:
  265. bral _I_CALL_TOP+0x80+0x20
  266. .global _060_isp_cas_inrange
  267. _060_isp_cas_inrange:
  268. bral _I_CALL_TOP+0x80+0x28
  269. .global _060_isp_cas_terminate
  270. _060_isp_cas_terminate:
  271. bral _I_CALL_TOP+0x80+0x30
  272. .global _060_isp_cas_restart
  273. _060_isp_cas_restart:
  274. bral _I_CALL_TOP+0x80+0x38
  275. |###########################################################################
  276. |###############################
  277. | (3) EXAMPLE CALL-OUT SECTION #
  278. |###############################
  279. | The size of this section MUST be 128 bytes!!!
  280. _I_CALL_TOP:
  281. .long _060_real_chk - _I_CALL_TOP
  282. .long _060_real_divbyzero - _I_CALL_TOP
  283. .long _060_real_trace - _I_CALL_TOP
  284. .long _060_real_access - _I_CALL_TOP
  285. .long _060_isp_done - _I_CALL_TOP
  286. .long _060_real_cas - _I_CALL_TOP
  287. .long _060_real_cas2 - _I_CALL_TOP
  288. .long _060_real_lock_page - _I_CALL_TOP
  289. .long _060_real_unlock_page - _I_CALL_TOP
  290. .long 0x00000000, 0x00000000, 0x00000000, 0x00000000
  291. .long 0x00000000, 0x00000000, 0x00000000
  292. .long _060_imem_read - _I_CALL_TOP
  293. .long _060_dmem_read - _I_CALL_TOP
  294. .long _060_dmem_write - _I_CALL_TOP
  295. .long _060_imem_read_word - _I_CALL_TOP
  296. .long _060_imem_read_long - _I_CALL_TOP
  297. .long _060_dmem_read_byte - _I_CALL_TOP
  298. .long _060_dmem_read_word - _I_CALL_TOP
  299. .long _060_dmem_read_long - _I_CALL_TOP
  300. .long _060_dmem_write_byte - _I_CALL_TOP
  301. .long _060_dmem_write_word - _I_CALL_TOP
  302. .long _060_dmem_write_long - _I_CALL_TOP
  303. .long 0x00000000
  304. .long 0x00000000, 0x00000000, 0x00000000, 0x00000000
  305. |###########################################################################
  306. | 060 INTEGER KERNEL PACKAGE MUST GO HERE!!!
  307. #include "isp.sa"