162306a36Sopenharmony_ci|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262306a36Sopenharmony_ci|MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP 362306a36Sopenharmony_ci|M68000 Hi-Performance Microprocessor Division 462306a36Sopenharmony_ci|M68060 Software Package 562306a36Sopenharmony_ci|Production Release P1.00 -- October 10, 1994 662306a36Sopenharmony_ci| 762306a36Sopenharmony_ci|M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 862306a36Sopenharmony_ci| 962306a36Sopenharmony_ci|THE SOFTWARE is provided on an "AS IS" basis and without warranty. 1062306a36Sopenharmony_ci|To the maximum extent permitted by applicable law, 1162306a36Sopenharmony_ci|MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 1262306a36Sopenharmony_ci|INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 1362306a36Sopenharmony_ci|and any warranty against infringement with regard to the SOFTWARE 1462306a36Sopenharmony_ci|(INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials. 1562306a36Sopenharmony_ci| 1662306a36Sopenharmony_ci|To the maximum extent permitted by applicable law, 1762306a36Sopenharmony_ci|IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER 1862306a36Sopenharmony_ci|(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, 1962306a36Sopenharmony_ci|BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) 2062306a36Sopenharmony_ci|ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE. 2162306a36Sopenharmony_ci|Motorola assumes no responsibility for the maintenance and support of the SOFTWARE. 2262306a36Sopenharmony_ci| 2362306a36Sopenharmony_ci|You are hereby granted a copyright license to use, modify, and distribute the SOFTWARE 2462306a36Sopenharmony_ci|so long as this entire notice is retained without alteration in any modified and/or 2562306a36Sopenharmony_ci|redistributed versions, and that such modified versions are clearly identified as such. 2662306a36Sopenharmony_ci|No licenses are granted by implication, estoppel or otherwise under any patents 2762306a36Sopenharmony_ci|or trademarks of Motorola, Inc. 2862306a36Sopenharmony_ci|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2962306a36Sopenharmony_ci| iskeleton.s 3062306a36Sopenharmony_ci| 3162306a36Sopenharmony_ci| This file contains: 3262306a36Sopenharmony_ci| (1) example "Call-out"s 3362306a36Sopenharmony_ci| (2) example package entry code 3462306a36Sopenharmony_ci| (3) example "Call-out" table 3562306a36Sopenharmony_ci| 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#include <linux/linkage.h> 3862306a36Sopenharmony_ci#include <asm/entry.h> 3962306a36Sopenharmony_ci#include <asm/asm-offsets.h> 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci|################################ 4362306a36Sopenharmony_ci| (1) EXAMPLE CALL-OUTS # 4462306a36Sopenharmony_ci| # 4562306a36Sopenharmony_ci| _060_isp_done() # 4662306a36Sopenharmony_ci| _060_real_chk() # 4762306a36Sopenharmony_ci| _060_real_divbyzero() # 4862306a36Sopenharmony_ci| # 4962306a36Sopenharmony_ci| _060_real_cas() # 5062306a36Sopenharmony_ci| _060_real_cas2() # 5162306a36Sopenharmony_ci| _060_real_lock_page() # 5262306a36Sopenharmony_ci| _060_real_unlock_page() # 5362306a36Sopenharmony_ci|################################ 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci| 5662306a36Sopenharmony_ci| _060_isp_done(): 5762306a36Sopenharmony_ci| 5862306a36Sopenharmony_ci| This is and example main exit point for the Unimplemented Integer 5962306a36Sopenharmony_ci| Instruction exception handler. For a normal exit, the 6062306a36Sopenharmony_ci| _isp_unimp() branches to here so that the operating system 6162306a36Sopenharmony_ci| can do any clean-up desired. The stack frame is the 6262306a36Sopenharmony_ci| Unimplemented Integer Instruction stack frame with 6362306a36Sopenharmony_ci| the PC pointing to the instruction following the instruction 6462306a36Sopenharmony_ci| just emulated. 6562306a36Sopenharmony_ci| To simply continue execution at the next instruction, just 6662306a36Sopenharmony_ci| do an "rte". 6762306a36Sopenharmony_ci| 6862306a36Sopenharmony_ci| Linux/68k: If returning to user space, check for needed reselections. 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci .global _060_isp_done 7162306a36Sopenharmony_ci_060_isp_done: 7262306a36Sopenharmony_ci btst #0x5,%sp@ | supervisor bit set in saved SR? 7362306a36Sopenharmony_ci beq .Lnotkern 7462306a36Sopenharmony_ci rte 7562306a36Sopenharmony_ci.Lnotkern: 7662306a36Sopenharmony_ci SAVE_ALL_INT 7762306a36Sopenharmony_ci GET_CURRENT(%d0) 7862306a36Sopenharmony_ci | deliver signals, reschedule etc.. 7962306a36Sopenharmony_ci jra ret_from_exception 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci| 8262306a36Sopenharmony_ci| _060_real_chk(): 8362306a36Sopenharmony_ci| 8462306a36Sopenharmony_ci| This is an alternate exit point for the Unimplemented Integer 8562306a36Sopenharmony_ci| Instruction exception handler. If the instruction was a "chk2" 8662306a36Sopenharmony_ci| and the operand was out of bounds, then _isp_unimp() creates 8762306a36Sopenharmony_ci| a CHK exception stack frame from the Unimplemented Integer Instrcution 8862306a36Sopenharmony_ci| stack frame and branches to this routine. 8962306a36Sopenharmony_ci| 9062306a36Sopenharmony_ci| Linux/68k: commented out test for tracing 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci .global _060_real_chk 9362306a36Sopenharmony_ci_060_real_chk: 9462306a36Sopenharmony_ci| tst.b (%sp) | is tracing enabled? 9562306a36Sopenharmony_ci| bpls real_chk_end | no 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ci| 9862306a36Sopenharmony_ci| CHK FRAME TRACE FRAME 9962306a36Sopenharmony_ci| ***************** ***************** 10062306a36Sopenharmony_ci| * Current PC * * Current PC * 10162306a36Sopenharmony_ci| ***************** ***************** 10262306a36Sopenharmony_ci| * 0x2 * 0x018 * * 0x2 * 0x024 * 10362306a36Sopenharmony_ci| ***************** ***************** 10462306a36Sopenharmony_ci| * Next * * Next * 10562306a36Sopenharmony_ci| * PC * * PC * 10662306a36Sopenharmony_ci| ***************** ***************** 10762306a36Sopenharmony_ci| * SR * * SR * 10862306a36Sopenharmony_ci| ***************** ***************** 10962306a36Sopenharmony_ci| 11062306a36Sopenharmony_ci| move.b #0x24,0x7(%sp) | set trace vecno 11162306a36Sopenharmony_ci| bral _060_real_trace 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_cireal_chk_end: 11462306a36Sopenharmony_ci bral trap | jump to trap handler 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci| 11762306a36Sopenharmony_ci| _060_real_divbyzero: 11862306a36Sopenharmony_ci| 11962306a36Sopenharmony_ci| This is an alternate exit point for the Unimplemented Integer 12062306a36Sopenharmony_ci| Instruction exception handler isp_unimp(). If the instruction is a 64-bit 12162306a36Sopenharmony_ci| integer divide where the source operand is a zero, then the _isp_unimp() 12262306a36Sopenharmony_ci| creates a Divide-by-zero exception stack frame from the Unimplemented 12362306a36Sopenharmony_ci| Integer Instruction stack frame and branches to this routine. 12462306a36Sopenharmony_ci| 12562306a36Sopenharmony_ci| Remember that a trace exception may be pending. The code below performs 12662306a36Sopenharmony_ci| no action associated with the "chk" exception. If tracing is enabled, 12762306a36Sopenharmony_ci| then it create a Trace exception stack frame from the "chk" exception 12862306a36Sopenharmony_ci| stack frame and branches to the _real_trace() entry point. 12962306a36Sopenharmony_ci| 13062306a36Sopenharmony_ci| Linux/68k: commented out test for tracing 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci .global _060_real_divbyzero 13362306a36Sopenharmony_ci_060_real_divbyzero: 13462306a36Sopenharmony_ci| tst.b (%sp) | is tracing enabled? 13562306a36Sopenharmony_ci| bpls real_divbyzero_end | no 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ci| 13862306a36Sopenharmony_ci| DIVBYZERO FRAME TRACE FRAME 13962306a36Sopenharmony_ci| ***************** ***************** 14062306a36Sopenharmony_ci| * Current PC * * Current PC * 14162306a36Sopenharmony_ci| ***************** ***************** 14262306a36Sopenharmony_ci| * 0x2 * 0x014 * * 0x2 * 0x024 * 14362306a36Sopenharmony_ci| ***************** ***************** 14462306a36Sopenharmony_ci| * Next * * Next * 14562306a36Sopenharmony_ci| * PC * * PC * 14662306a36Sopenharmony_ci| ***************** ***************** 14762306a36Sopenharmony_ci| * SR * * SR * 14862306a36Sopenharmony_ci| ***************** ***************** 14962306a36Sopenharmony_ci| 15062306a36Sopenharmony_ci| move.b #0x24,0x7(%sp) | set trace vecno 15162306a36Sopenharmony_ci| bral _060_real_trace 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_cireal_divbyzero_end: 15462306a36Sopenharmony_ci bral trap | jump to trap handler 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci|########################## 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci| 15962306a36Sopenharmony_ci| _060_real_cas(): 16062306a36Sopenharmony_ci| 16162306a36Sopenharmony_ci| Entry point for the selected cas emulation code implementation. 16262306a36Sopenharmony_ci| If the implementation provided by the 68060ISP is sufficient, 16362306a36Sopenharmony_ci| then this routine simply re-enters the package through _isp_cas. 16462306a36Sopenharmony_ci| 16562306a36Sopenharmony_ci .global _060_real_cas 16662306a36Sopenharmony_ci_060_real_cas: 16762306a36Sopenharmony_ci bral _I_CALL_TOP+0x80+0x08 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci| 17062306a36Sopenharmony_ci| _060_real_cas2(): 17162306a36Sopenharmony_ci| 17262306a36Sopenharmony_ci| Entry point for the selected cas2 emulation code implementation. 17362306a36Sopenharmony_ci| If the implementation provided by the 68060ISP is sufficient, 17462306a36Sopenharmony_ci| then this routine simply re-enters the package through _isp_cas2. 17562306a36Sopenharmony_ci| 17662306a36Sopenharmony_ci .global _060_real_cas2 17762306a36Sopenharmony_ci_060_real_cas2: 17862306a36Sopenharmony_ci bral _I_CALL_TOP+0x80+0x10 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci| 18162306a36Sopenharmony_ci| _060_lock_page(): 18262306a36Sopenharmony_ci| 18362306a36Sopenharmony_ci| Entry point for the operating system`s routine to "lock" a page 18462306a36Sopenharmony_ci| from being paged out. This routine is needed by the cas/cas2 18562306a36Sopenharmony_ci| algorithms so that no page faults occur within the "core" code 18662306a36Sopenharmony_ci| region. Note: the routine must lock two pages if the operand 18762306a36Sopenharmony_ci| spans two pages. 18862306a36Sopenharmony_ci| NOTE: THE ROUTINE SHOULD RETURN AN FSLW VALUE IN D0 ON FAILURE 18962306a36Sopenharmony_ci| SO THAT THE 060SP CAN CREATE A PROPER ACCESS ERROR FRAME. 19062306a36Sopenharmony_ci| Arguments: 19162306a36Sopenharmony_ci| a0 = operand address 19262306a36Sopenharmony_ci| d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user 19362306a36Sopenharmony_ci| d1 = `xxxxxxff -> longword; `xxxxxx00 -> word 19462306a36Sopenharmony_ci| Expected outputs: 19562306a36Sopenharmony_ci| d0 = 0 -> success; non-zero -> failure 19662306a36Sopenharmony_ci| 19762306a36Sopenharmony_ci| Linux/m68k: Make sure the page is properly paged in, so we use 19862306a36Sopenharmony_ci| plpaw and handle any exception here. The kernel must not be 19962306a36Sopenharmony_ci| preempted until _060_unlock_page(), so that the page stays mapped. 20062306a36Sopenharmony_ci| 20162306a36Sopenharmony_ci .global _060_real_lock_page 20262306a36Sopenharmony_ci_060_real_lock_page: 20362306a36Sopenharmony_ci move.l %d2,-(%sp) 20462306a36Sopenharmony_ci | load sfc/dfc 20562306a36Sopenharmony_ci tst.b %d0 20662306a36Sopenharmony_ci jne 1f 20762306a36Sopenharmony_ci moveq #1,%d0 20862306a36Sopenharmony_ci jra 2f 20962306a36Sopenharmony_ci1: moveq #5,%d0 21062306a36Sopenharmony_ci2: movec.l %dfc,%d2 21162306a36Sopenharmony_ci movec.l %d0,%dfc 21262306a36Sopenharmony_ci movec.l %d0,%sfc 21362306a36Sopenharmony_ci 21462306a36Sopenharmony_ci clr.l %d0 21562306a36Sopenharmony_ci | prefetch address 21662306a36Sopenharmony_ci .chip 68060 21762306a36Sopenharmony_ci move.l %a0,%a1 21862306a36Sopenharmony_ci1: plpaw (%a1) 21962306a36Sopenharmony_ci addq.w #1,%a0 22062306a36Sopenharmony_ci tst.b %d1 22162306a36Sopenharmony_ci jeq 2f 22262306a36Sopenharmony_ci addq.w #2,%a0 22362306a36Sopenharmony_ci2: plpaw (%a0) 22462306a36Sopenharmony_ci3: .chip 68k 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ci | restore sfc/dfc 22762306a36Sopenharmony_ci movec.l %d2,%dfc 22862306a36Sopenharmony_ci movec.l %d2,%sfc 22962306a36Sopenharmony_ci move.l (%sp)+,%d2 23062306a36Sopenharmony_ci rts 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci.section __ex_table,"a" 23362306a36Sopenharmony_ci .align 4 23462306a36Sopenharmony_ci .long 1b,11f 23562306a36Sopenharmony_ci .long 2b,21f 23662306a36Sopenharmony_ci.previous 23762306a36Sopenharmony_ci.section .fixup,"ax" 23862306a36Sopenharmony_ci .even 23962306a36Sopenharmony_ci11: move.l #0x020003c0,%d0 24062306a36Sopenharmony_ci or.l %d2,%d0 24162306a36Sopenharmony_ci swap %d0 24262306a36Sopenharmony_ci jra 3b 24362306a36Sopenharmony_ci21: move.l #0x02000bc0,%d0 24462306a36Sopenharmony_ci or.l %d2,%d0 24562306a36Sopenharmony_ci swap %d0 24662306a36Sopenharmony_ci jra 3b 24762306a36Sopenharmony_ci.previous 24862306a36Sopenharmony_ci 24962306a36Sopenharmony_ci| 25062306a36Sopenharmony_ci| _060_unlock_page(): 25162306a36Sopenharmony_ci| 25262306a36Sopenharmony_ci| Entry point for the operating system`s routine to "unlock" a 25362306a36Sopenharmony_ci| page that has been "locked" previously with _real_lock_page. 25462306a36Sopenharmony_ci| Note: the routine must unlock two pages if the operand spans 25562306a36Sopenharmony_ci| two pages. 25662306a36Sopenharmony_ci| Arguments: 25762306a36Sopenharmony_ci| a0 = operand address 25862306a36Sopenharmony_ci| d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user 25962306a36Sopenharmony_ci| d1 = `xxxxxxff -> longword; `xxxxxx00 -> word 26062306a36Sopenharmony_ci| 26162306a36Sopenharmony_ci| Linux/m68k: perhaps reenable preemption here... 26262306a36Sopenharmony_ci 26362306a36Sopenharmony_ci .global _060_real_unlock_page 26462306a36Sopenharmony_ci_060_real_unlock_page: 26562306a36Sopenharmony_ci clr.l %d0 26662306a36Sopenharmony_ci rts 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_ci|########################################################################### 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ci|################################# 27162306a36Sopenharmony_ci| (2) EXAMPLE PACKAGE ENTRY CODE # 27262306a36Sopenharmony_ci|################################# 27362306a36Sopenharmony_ci 27462306a36Sopenharmony_ci .global _060_isp_unimp 27562306a36Sopenharmony_ci_060_isp_unimp: 27662306a36Sopenharmony_ci bral _I_CALL_TOP+0x80+0x00 27762306a36Sopenharmony_ci 27862306a36Sopenharmony_ci .global _060_isp_cas 27962306a36Sopenharmony_ci_060_isp_cas: 28062306a36Sopenharmony_ci bral _I_CALL_TOP+0x80+0x08 28162306a36Sopenharmony_ci 28262306a36Sopenharmony_ci .global _060_isp_cas2 28362306a36Sopenharmony_ci_060_isp_cas2: 28462306a36Sopenharmony_ci bral _I_CALL_TOP+0x80+0x10 28562306a36Sopenharmony_ci 28662306a36Sopenharmony_ci .global _060_isp_cas_finish 28762306a36Sopenharmony_ci_060_isp_cas_finish: 28862306a36Sopenharmony_ci bra.l _I_CALL_TOP+0x80+0x18 28962306a36Sopenharmony_ci 29062306a36Sopenharmony_ci .global _060_isp_cas2_finish 29162306a36Sopenharmony_ci_060_isp_cas2_finish: 29262306a36Sopenharmony_ci bral _I_CALL_TOP+0x80+0x20 29362306a36Sopenharmony_ci 29462306a36Sopenharmony_ci .global _060_isp_cas_inrange 29562306a36Sopenharmony_ci_060_isp_cas_inrange: 29662306a36Sopenharmony_ci bral _I_CALL_TOP+0x80+0x28 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_ci .global _060_isp_cas_terminate 29962306a36Sopenharmony_ci_060_isp_cas_terminate: 30062306a36Sopenharmony_ci bral _I_CALL_TOP+0x80+0x30 30162306a36Sopenharmony_ci 30262306a36Sopenharmony_ci .global _060_isp_cas_restart 30362306a36Sopenharmony_ci_060_isp_cas_restart: 30462306a36Sopenharmony_ci bral _I_CALL_TOP+0x80+0x38 30562306a36Sopenharmony_ci 30662306a36Sopenharmony_ci|########################################################################### 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_ci|############################### 30962306a36Sopenharmony_ci| (3) EXAMPLE CALL-OUT SECTION # 31062306a36Sopenharmony_ci|############################### 31162306a36Sopenharmony_ci 31262306a36Sopenharmony_ci| The size of this section MUST be 128 bytes!!! 31362306a36Sopenharmony_ci 31462306a36Sopenharmony_ci_I_CALL_TOP: 31562306a36Sopenharmony_ci .long _060_real_chk - _I_CALL_TOP 31662306a36Sopenharmony_ci .long _060_real_divbyzero - _I_CALL_TOP 31762306a36Sopenharmony_ci .long _060_real_trace - _I_CALL_TOP 31862306a36Sopenharmony_ci .long _060_real_access - _I_CALL_TOP 31962306a36Sopenharmony_ci .long _060_isp_done - _I_CALL_TOP 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_ci .long _060_real_cas - _I_CALL_TOP 32262306a36Sopenharmony_ci .long _060_real_cas2 - _I_CALL_TOP 32362306a36Sopenharmony_ci .long _060_real_lock_page - _I_CALL_TOP 32462306a36Sopenharmony_ci .long _060_real_unlock_page - _I_CALL_TOP 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_ci .long 0x00000000, 0x00000000, 0x00000000, 0x00000000 32762306a36Sopenharmony_ci .long 0x00000000, 0x00000000, 0x00000000 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci .long _060_imem_read - _I_CALL_TOP 33062306a36Sopenharmony_ci .long _060_dmem_read - _I_CALL_TOP 33162306a36Sopenharmony_ci .long _060_dmem_write - _I_CALL_TOP 33262306a36Sopenharmony_ci .long _060_imem_read_word - _I_CALL_TOP 33362306a36Sopenharmony_ci .long _060_imem_read_long - _I_CALL_TOP 33462306a36Sopenharmony_ci .long _060_dmem_read_byte - _I_CALL_TOP 33562306a36Sopenharmony_ci .long _060_dmem_read_word - _I_CALL_TOP 33662306a36Sopenharmony_ci .long _060_dmem_read_long - _I_CALL_TOP 33762306a36Sopenharmony_ci .long _060_dmem_write_byte - _I_CALL_TOP 33862306a36Sopenharmony_ci .long _060_dmem_write_word - _I_CALL_TOP 33962306a36Sopenharmony_ci .long _060_dmem_write_long - _I_CALL_TOP 34062306a36Sopenharmony_ci 34162306a36Sopenharmony_ci .long 0x00000000 34262306a36Sopenharmony_ci .long 0x00000000, 0x00000000, 0x00000000, 0x00000000 34362306a36Sopenharmony_ci 34462306a36Sopenharmony_ci|########################################################################### 34562306a36Sopenharmony_ci 34662306a36Sopenharmony_ci| 060 INTEGER KERNEL PACKAGE MUST GO HERE!!! 34762306a36Sopenharmony_ci#include "isp.sa" 348