Back to home page

LXR

 
 

    


0001 |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0002 |MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
0003 |M68000 Hi-Performance Microprocessor Division
0004 |M68060 Software Package
0005 |Production Release P1.00 -- October 10, 1994
0006 |
0007 |M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
0008 |
0009 |THE SOFTWARE is provided on an "AS IS" basis and without warranty.
0010 |To the maximum extent permitted by applicable law,
0011 |MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
0012 |INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
0013 |and any warranty against infringement with regard to the SOFTWARE
0014 |(INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
0015 |
0016 |To the maximum extent permitted by applicable law,
0017 |IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
0018 |(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
0019 |BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
0020 |ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
0021 |Motorola assumes no responsibility for the maintenance and support of the SOFTWARE.
0022 |
0023 |You are hereby granted a copyright license to use, modify, and distribute the SOFTWARE
0024 |so long as this entire notice is retained without alteration in any modified and/or
0025 |redistributed versions, and that such modified versions are clearly identified as such.
0026 |No licenses are granted by implication, estoppel or otherwise under any patents
0027 |or trademarks of Motorola, Inc.
0028 |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0029 | iskeleton.s
0030 |
0031 | This file contains:
0032 |   (1) example "Call-out"s
0033 |   (2) example package entry code
0034 |   (3) example "Call-out" table
0035 |
0036 
0037 #include <linux/linkage.h>
0038 #include <asm/entry.h>
0039 #include <asm/asm-offsets.h>
0040 
0041 
0042 |################################
0043 | (1) EXAMPLE CALL-OUTS     #
0044 |               #
0045 | _060_isp_done()       #
0046 | _060_real_chk()       #
0047 | _060_real_divbyzero()     #
0048 |               #
0049 | _060_real_cas()       #
0050 | _060_real_cas2()      #
0051 | _060_real_lock_page()     #
0052 | _060_real_unlock_page()   #
0053 |################################
0054 
0055 |
0056 | _060_isp_done():
0057 |
0058 | This is and example main exit point for the Unimplemented Integer
0059 | Instruction exception handler. For a normal exit, the
0060 | _isp_unimp() branches to here so that the operating system
0061 | can do any clean-up desired. The stack frame is the
0062 | Unimplemented Integer Instruction stack frame with
0063 | the PC pointing to the instruction following the instruction
0064 | just emulated.
0065 | To simply continue execution at the next instruction, just
0066 | do an "rte".
0067 |
0068 | Linux/68k: If returning to user space, check for needed reselections.
0069 
0070     .global     _060_isp_done
0071 _060_isp_done:
0072     btst    #0x5,%sp@       | supervisor bit set in saved SR?
0073     beq .Lnotkern
0074     rte
0075 .Lnotkern:
0076     SAVE_ALL_INT
0077     GET_CURRENT(%d0)
0078     | deliver signals, reschedule etc..
0079     jra ret_from_exception
0080 
0081 |
0082 | _060_real_chk():
0083 |
0084 | This is an alternate exit point for the Unimplemented Integer
0085 | Instruction exception handler. If the instruction was a "chk2"
0086 | and the operand was out of bounds, then _isp_unimp() creates
0087 | a CHK exception stack frame from the Unimplemented Integer Instrcution
0088 | stack frame and branches to this routine.
0089 |
0090 | Linux/68k: commented out test for tracing
0091 
0092     .global     _060_real_chk
0093 _060_real_chk:
0094 |   tst.b       (%sp)           | is tracing enabled?
0095 |   bpls        real_chk_end        | no
0096 
0097 |
0098 |       CHK FRAME          TRACE FRAME
0099 |   *****************   *****************
0100 |   *   Current PC  *   *   Current PC  *
0101 |   *****************   *****************
0102 |   * 0x2 *  0x018  *   * 0x2 *  0x024  *
0103 |   *****************   *****************
0104 |   *     Next  *   *     Next  *
0105 |   *      PC   *   *      PC   *
0106 |   *****************   *****************
0107 |   *      SR   *   *      SR   *
0108 |   *****************   *****************
0109 |
0110 |   move.b      #0x24,0x7(%sp)      | set trace vecno
0111 |   bral        _060_real_trace
0112 
0113 real_chk_end:
0114     bral        trap            | jump to trap handler
0115 
0116 |
0117 | _060_real_divbyzero:
0118 |
0119 | This is an alternate exit point for the Unimplemented Integer
0120 | Instruction exception handler isp_unimp(). If the instruction is a 64-bit
0121 | integer divide where the source operand is a zero, then the _isp_unimp()
0122 | creates a Divide-by-zero exception stack frame from the Unimplemented
0123 | Integer Instruction stack frame and branches to this routine.
0124 |
0125 | Remember that a trace exception may be pending. The code below performs
0126 | no action associated with the "chk" exception. If tracing is enabled,
0127 | then it create a Trace exception stack frame from the "chk" exception
0128 | stack frame and branches to the _real_trace() entry point.
0129 |
0130 | Linux/68k: commented out test for tracing
0131 
0132     .global     _060_real_divbyzero
0133 _060_real_divbyzero:
0134 |   tst.b       (%sp)           | is tracing enabled?
0135 |   bpls        real_divbyzero_end  | no
0136 
0137 |
0138 |    DIVBYZERO FRAME       TRACE FRAME
0139 |   *****************   *****************
0140 |   *   Current PC  *   *   Current PC  *
0141 |   *****************   *****************
0142 |   * 0x2 *  0x014  *   * 0x2 *  0x024  *
0143 |   *****************   *****************
0144 |   *     Next  *   *     Next  *
0145 |   *      PC   *   *      PC   *
0146 |   *****************   *****************
0147 |   *      SR   *   *      SR   *
0148 |   *****************   *****************
0149 |
0150 |   move.b      #0x24,0x7(%sp)      | set trace vecno
0151 |   bral        _060_real_trace
0152 
0153 real_divbyzero_end:
0154     bral        trap            | jump to trap handler
0155 
0156 |##########################
0157 
0158 |
0159 | _060_real_cas():
0160 |
0161 | Entry point for the selected cas emulation code implementation.
0162 | If the implementation provided by the 68060ISP is sufficient,
0163 | then this routine simply re-enters the package through _isp_cas.
0164 |
0165     .global     _060_real_cas
0166 _060_real_cas:
0167     bral        _I_CALL_TOP+0x80+0x08
0168 
0169 |
0170 | _060_real_cas2():
0171 |
0172 | Entry point for the selected cas2 emulation code implementation.
0173 | If the implementation provided by the 68060ISP is sufficient,
0174 | then this routine simply re-enters the package through _isp_cas2.
0175 |
0176     .global     _060_real_cas2
0177 _060_real_cas2:
0178     bral        _I_CALL_TOP+0x80+0x10
0179 
0180 |
0181 | _060_lock_page():
0182 |
0183 | Entry point for the operating system`s routine to "lock" a page
0184 | from being paged out. This routine is needed by the cas/cas2
0185 | algorithms so that no page faults occur within the "core" code
0186 | region. Note: the routine must lock two pages if the operand
0187 | spans two pages.
0188 | NOTE: THE ROUTINE SHOULD RETURN AN FSLW VALUE IN D0 ON FAILURE
0189 | SO THAT THE 060SP CAN CREATE A PROPER ACCESS ERROR FRAME.
0190 | Arguments:
0191 |   a0 = operand address
0192 |   d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user
0193 |   d1 = `xxxxxxff -> longword; `xxxxxx00 -> word
0194 | Expected outputs:
0195 |   d0 = 0 -> success; non-zero -> failure
0196 |
0197 | Linux/m68k: Make sure the page is properly paged in, so we use
0198 | plpaw and handle any exception here. The kernel must not be
0199 | preempted until _060_unlock_page(), so that the page stays mapped.
0200 |
0201     .global     _060_real_lock_page
0202 _060_real_lock_page:
0203     move.l  %d2,-(%sp)
0204     | load sfc/dfc
0205     tst.b   %d0
0206     jne 1f
0207     moveq   #1,%d0
0208     jra 2f
0209 1:  moveq   #5,%d0
0210 2:  movec.l %dfc,%d2
0211     movec.l %d0,%dfc
0212     movec.l %d0,%sfc
0213 
0214     clr.l   %d0
0215     | prefetch address
0216     .chip   68060
0217     move.l  %a0,%a1
0218 1:  plpaw   (%a1)
0219     addq.w  #1,%a0
0220     tst.b   %d1
0221     jeq 2f
0222     addq.w  #2,%a0
0223 2:  plpaw   (%a0)
0224 3:  .chip   68k
0225 
0226     | restore sfc/dfc
0227     movec.l %d2,%dfc
0228     movec.l %d2,%sfc
0229     move.l  (%sp)+,%d2
0230     rts
0231 
0232 .section __ex_table,"a"
0233     .align  4
0234     .long   1b,11f
0235     .long   2b,21f
0236 .previous
0237 .section .fixup,"ax"
0238     .even
0239 11: move.l  #0x020003c0,%d0
0240     or.l    %d2,%d0
0241     swap    %d0
0242     jra 3b
0243 21: move.l  #0x02000bc0,%d0
0244     or.l    %d2,%d0
0245     swap    %d0
0246     jra 3b
0247 .previous
0248 
0249 |
0250 | _060_unlock_page():
0251 |
0252 | Entry point for the operating system`s routine to "unlock" a
0253 | page that has been "locked" previously with _real_lock_page.
0254 | Note: the routine must unlock two pages if the operand spans
0255 | two pages.
0256 | Arguments:
0257 |   a0 = operand address
0258 |   d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user
0259 |   d1 = `xxxxxxff -> longword; `xxxxxx00 -> word
0260 |
0261 | Linux/m68k: perhaps reenable preemption here...
0262 
0263     .global     _060_real_unlock_page
0264 _060_real_unlock_page:
0265     clr.l       %d0
0266     rts
0267 
0268 |###########################################################################
0269 
0270 |#################################
0271 | (2) EXAMPLE PACKAGE ENTRY CODE #
0272 |#################################
0273 
0274     .global     _060_isp_unimp
0275 _060_isp_unimp:
0276     bral        _I_CALL_TOP+0x80+0x00
0277 
0278     .global     _060_isp_cas
0279 _060_isp_cas:
0280     bral        _I_CALL_TOP+0x80+0x08
0281 
0282     .global     _060_isp_cas2
0283 _060_isp_cas2:
0284     bral        _I_CALL_TOP+0x80+0x10
0285 
0286     .global     _060_isp_cas_finish
0287 _060_isp_cas_finish:
0288     bra.l       _I_CALL_TOP+0x80+0x18
0289 
0290     .global     _060_isp_cas2_finish
0291 _060_isp_cas2_finish:
0292     bral        _I_CALL_TOP+0x80+0x20
0293 
0294     .global     _060_isp_cas_inrange
0295 _060_isp_cas_inrange:
0296     bral        _I_CALL_TOP+0x80+0x28
0297 
0298     .global     _060_isp_cas_terminate
0299 _060_isp_cas_terminate:
0300     bral        _I_CALL_TOP+0x80+0x30
0301 
0302     .global     _060_isp_cas_restart
0303 _060_isp_cas_restart:
0304     bral        _I_CALL_TOP+0x80+0x38
0305 
0306 |###########################################################################
0307 
0308 |###############################
0309 | (3) EXAMPLE CALL-OUT SECTION #
0310 |###############################
0311 
0312 | The size of this section MUST be 128 bytes!!!
0313 
0314 _I_CALL_TOP:
0315     .long   _060_real_chk       - _I_CALL_TOP
0316     .long   _060_real_divbyzero - _I_CALL_TOP
0317     .long   _060_real_trace     - _I_CALL_TOP
0318     .long   _060_real_access    - _I_CALL_TOP
0319     .long   _060_isp_done       - _I_CALL_TOP
0320 
0321     .long   _060_real_cas       - _I_CALL_TOP
0322     .long   _060_real_cas2      - _I_CALL_TOP
0323     .long   _060_real_lock_page - _I_CALL_TOP
0324     .long   _060_real_unlock_page   - _I_CALL_TOP
0325 
0326     .long   0x00000000, 0x00000000, 0x00000000, 0x00000000
0327     .long   0x00000000, 0x00000000, 0x00000000
0328 
0329     .long   _060_imem_read      - _I_CALL_TOP
0330     .long   _060_dmem_read      - _I_CALL_TOP
0331     .long   _060_dmem_write     - _I_CALL_TOP
0332     .long   _060_imem_read_word - _I_CALL_TOP
0333     .long   _060_imem_read_long - _I_CALL_TOP
0334     .long   _060_dmem_read_byte - _I_CALL_TOP
0335     .long   _060_dmem_read_word - _I_CALL_TOP
0336     .long   _060_dmem_read_long - _I_CALL_TOP
0337     .long   _060_dmem_write_byte    - _I_CALL_TOP
0338     .long   _060_dmem_write_word    - _I_CALL_TOP
0339     .long   _060_dmem_write_long    - _I_CALL_TOP
0340 
0341     .long   0x00000000
0342     .long   0x00000000, 0x00000000, 0x00000000, 0x00000000
0343 
0344 |###########################################################################
0345 
0346 | 060 INTEGER KERNEL PACKAGE MUST GO HERE!!!
0347 #include "isp.sa"