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