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