1 # 2 # $NetBSD: fpsp.doc,v 1.2 2007/04/29 20:23:35 msaitoh Exp $ 3 # 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 38 68060 FLOATING-POINT SOFTWARE PACKAGE (Kernel version) 39 ------------------------------------------------------- 40 41 The file fpsp.sa contains the 68060 Floating-Point Software 42 Package. This package is essentially a set of exception handlers 43 that can be integrated into an operating system. 44 These exception handlers emulate Unimplemented FP instructions, 45 instructions using unimplemented data types, and instructions 46 using unimplemented addressing modes. In addition, this package 47 includes exception handlers to provide full IEEE-754 compliant 48 exception handling. 49 50 Release file format: 51 -------------------- 52 The file fpsp.sa is essentially a hexadecimal image of the 53 release package. This is the ONLY format which will be supported. 54 The hex image was created by assembling the source code and 55 then converting the resulting binary output image into an 56 ASCII text file. The hexadecimal numbers are listed 57 using the Motorola Assembly Syntax assembler directive "dc.l" 58 (define constant longword). The file can be converted to other 59 assembly syntaxes by using any word processor with a global 60 search and replace function. 61 62 To assist in assembling and linking this module with other modules, 63 the installer should add a symbolic label to the top of the file. 64 This will allow calling routines to access the entry points 65 of this package. 66 67 The source code fpsp.s has also been included but only for 68 documentation purposes. 69 70 Release file structure: 71 ----------------------- 72 73 (top of module) 74 ----------------- 75 | | - 128 byte-sized section 76 (1) | Call-Out | - 4 bytes per entry (user fills these in) 77 | | - example routines in fskeleton.s 78 ----------------- 79 | | - 8 bytes per entry 80 (2) | Entry Point | - user does "bra" or "jmp" to this address 81 | | 82 ----------------- 83 | | - code section 84 (3) ~ ~ 85 | | 86 ----------------- 87 (bottom of module) 88 89 The first section of this module is the "Call-out" section. This section 90 is NOT INCLUDED in fpsp.sa (an example "Call-out" section is provided at 91 the end of the file fskeleton.s). The purpose of this section is to allow 92 the FPSP routines to reference external functions that must be provided 93 by the host operating system. This section MUST be exactly 128 bytes in 94 size. There are 32 fields, each 4 bytes in size. Each field corresponds 95 to a function required by the FPSP (these functions and their location are 96 listed in "68060FPSP call-outs" below). Each field entry should contain 97 the address of the corresponding function RELATIVE to the starting address 98 of the "call-out" section. The "Call-out" section must sit adjacent to the 99 fpsp.sa image in memory. 100 101 The second section, the "Entry-point" section, is used by external routines 102 to access the functions within the FPSP. Since the fpsp.sa hex file contains 103 no symbol names, this section contains function entry points that are fixed 104 with respect to the top of the package. The currently defined entry-points 105 are listed in section "68060 FPSP entry points" below. A calling routine 106 would simply execute a "bra" or "jmp" that jumped to the selected function 107 entry-point. 108 109 For example, if the 68060 hardware took a "Line-F Emulator" exception 110 (vector #11), the operating system should execute something similar to: 111 112 bra _060FPSP_TOP+128+48 113 114 (_060FPSP_TOP is the starting address of the "Call-out" section; the "Call-out" 115 section is 128 bytes long; and the F-Line FPSP handler entry point is located 116 48 bytes from the top of the "Entry-point" section.) 117 118 The third section is the code section. After entering through an "Entry-point", 119 the entry code jumps to the appropriate emulation code within the code section. 120 121 68060FPSP call-outs: (details in fskeleton.s) 122 -------------------- 123 0x000: _060_real_bsun 124 0x004: _060_real_snan 125 0x008: _060_real_operr 126 0x00c: _060_real_ovfl 127 0x010: _060_real_unfl 128 0x014: _060_real_dz 129 0x018: _060_real_inex 130 0x01c: _060_real_fline 131 0x020: _060_real_fpu_disabled 132 0x024: _060_real_trap 133 0x028: _060_real_trace 134 0x02c: _060_real_access 135 0x030: _060_fpsp_done 136 137 0x034: (Motorola reserved) 138 0x038: (Motorola reserved) 139 0x03c: (Motorola reserved) 140 141 0x040: _060_imem_read 142 0x044: _060_dmem_read 143 0x048: _060_dmem_write 144 0x04c: _060_imem_read_word 145 0x050: _060_imem_read_long 146 0x054: _060_dmem_read_byte 147 0x058: _060_dmem_read_word 148 0x05c: _060_dmem_read_long 149 0x060: _060_dmem_write_byte 150 0x064: _060_dmem_write_word 151 0x068: _060_dmem_write_long 152 153 0x06c: (Motorola reserved) 154 0x070: (Motorola reserved) 155 0x074: (Motorola reserved) 156 0x078: (Motorola reserved) 157 0x07c: (Motorola reserved) 158 159 68060FPSP entry points: 160 ----------------------- 161 0x000: _060_fpsp_snan 162 0x008: _060_fpsp_operr 163 0x010: _060_fpsp_ovfl 164 0x018: _060_fpsp_unfl 165 0x020: _060_fpsp_dz 166 0x028: _060_fpsp_inex 167 0x030: _060_fpsp_fline 168 0x038: _060_fpsp_unsupp 169 0x040: _060_fpsp_effadd 170 171 173 Miscellaneous: 174 -------------- 175 176 _060_fpsp_snan: 177 ---------------- 178 - documented in 3.5 of 060SP spec. 179 - Basic flow: 180 exception taken ---> enter _060_fpsp_snan --| 181 | 182 always exits through _060_real_snan <---- 183 184 _060_fpsp_operr: 185 ---------------- 186 - documented in 3.5 of 060SP spec. 187 - Basic flow: 188 exception taken ---> enter _060_fpsp_operr --| 189 | 190 always exits through _060_real_operr <----- 191 192 _060_fpsp_dz: 193 ---------------- 194 - documented in 3.7 of 060SP spec. 195 - Basic flow: 196 exception taken ---> enter _060_fpsp_dz --| 197 | 198 always exits through _060_real_dz <---- 199 200 _060_fpsp_inex: 201 ---------------- 202 - documented in 3.6 of 060SP spec. 203 - Basic flow: 204 exception taken ---> enter _060_fpsp_inex --| 205 | 206 always exits through _060_real_inex <---- 207 209 _060_fpsp_ovfl: 210 ---------------- 211 - documented in 3.4 of 060SP spec. 212 - Basic flow: 213 exception taken ---> enter _060_fpsp_ovfl --| 214 | 215 may exit through _060_real_inex <---| 216 or | 217 may exit through _060_real_ovfl <---| 218 or | 219 may exit through _060_fpsp_done <---| 220 221 _060_fpsp_unfl: 222 ---------------- 223 - documented in 3.4 of 060SP spec. 224 - Basic flow: 225 exception taken ---> enter _060_fpsp_unfl --| 226 | 227 may exit through _060_real_inex <---| 228 or | 229 may exit through _060_real_unfl <---| 230 or | 231 may exit through _060_fpsp_done <---| 232 234 _060_fpsp_fline: 235 ----------------- 236 - not fully documented in 060SP spec. 237 - Basic flow: 238 exception taken ---> enter _060_fpsp_fline --| 239 | 240 ------------------------------------------- 241 | | | 242 v v v 243 (unimplemented (fpu disabled) (possible F-line illegal) 244 stack frame) | v 245 | v special case "fmovecr"? 246 | exit through | 247 | _060_real_fpu_disabled ------------- 248 | | | 249 | ^ v v 250 | | (yes) (no) 251 | | v v 252 | | fpu disabled? exit through 253 | | | _060_real_fline 254 v | ------------- 255 | | | | 256 | | v v 257 | |-----------(yes) (no) 258 | | 259 |----<------------------------------------| 260 | 261 | 262 |----> may exit through _060_real_trace 263 | 264 |----> may exit through _060_real_trap 265 | 266 |----> may exit through _060_real_bsun 267 | 268 |----> may exit through _060_fpsp_done 269 271 _060_fpsp_unsupp: 272 ------------------ 273 - documented in 3.1 of 060SP spec. 274 - Basic flow: 275 exception taken ---> enter _060_fpsp_unsupp --| 276 | 277 | 278 may exit through _060_real_snan <----| 279 or | 280 may exit through _060_real_operr <----| 281 or | 282 may exit through _060_real_ovfl <----| 283 or | 284 may exit through _060_real_unfl <----| 285 or | 286 may exit through _060_real_inex <----| 287 or | 288 may exit through _060_real_trace <----| 289 or | 290 may exit through _060_fpsp_done <----| 291 293 _060_fpsp_effadd: 294 ------------------ 295 - documented in 3.3 of 060 spec. 296 - Basic flow: 297 exception taken ---> enter _060_fpsp_effadd --| 298 | 299 | 300 may exit through _060_real_trace <----| 301 or | 302 may exit through _060_real_fpu_disabled <----| 303 or | 304 may exit through _060_fpsp_done <----| 305